RSYNC
Synchronize files between multiple systems
Can perform one-time copies
Can be used to setup scheduled synchronizations
Operations can be one-way or bidirectional
General usage
rsync <options> <source> <destination>
Backup a folder to another location
rsync -azurP ./Documents/ ./Backup/
-a Archive (copy attributes) -z Compress with gzip -u Skip files that are already there -r Recursive -P Display progress
Output:
Remote Backup
rsync Listener
Requires rsync running on the remote host
TCP port 873
Fairly dated, not secure
rsync -azurP ./Documents touk@192.168.1.12:/home/touk/Backup
Now, if run this and make sure the port 873 is open, it’s going to wok but this is not secure
Another way to do this is by telling rsync to use ssh tunnel, and you won’t need port 873 to be open
rsync -azurP -e ssh ./Documents touk@192.168.1.12:/home/touk/Backup
NOW, BIG NOTE!!
You are going to be prompted for a password if you didn’t set up a certificate between the machines, so do that first
how to?
On your local machine, generate an SSH keypair (in case you don’t have one)
ssh-keygen -t rsa
Copy the public key to the remote server. This appends it to the authorized_keys file:
ssh-copy-id touk@192.168.1.12
Try to SSH and you won’t be asked for password
Output on local machine:
Output on Remote Machine:
Does not actually copy/delete files
Preserving permissions
Requires root
-ogA
-o Owner
-g Group
-p Permissions
-A ACLs (implies -p)
Last updated