Install Rsync

Rsync Installation Instuctions
sudo apt-get install rsync
sudo vi /etc/rsyncd.conf

copy into rsyncd.conf

motd file = /etc/rsyncd.motd


path = /home/username comment = This is the path to folder on the server uid = nobody gid = nobody read only = false auth users = username secrets file = /etc/rsyncd.scrt

change username/servername

sudo vi /etc/rsyncd.motd

any message you want

sudo vi /etc/rsyncd.scrt


sudo vi /etc/default/rsync


sudo /etc/init.d/rsync restart

Rsync Command Example | Explanation
sudo rsync -azv /usr/backup_slice1/ /media/backup_slice1


This tells rsync to not actually do anything. It will just write a log of what it would do to the screen. Once you’ve made sure everything will work as you expect, you have to remove this option, and run the command again to perform the actual backup.


deletes files that don’t exist on the system being backed up.(Optional)


preserves the date and times, and permissions of the files (same as -rlptgoD)

With this option rsync will do all the following:
Descend recursively into all directories (-r)
copy symlinks as symlinks (-l)
preserve file permissions (-p)
preserve modification times (-t)
preserve groups (-g)
preserve file ownership (-o)
preserve devices as devices (-D)

compresses the data


increases the verbosity of the reporting process


specifies remote shell to use

Rsync Command Examples
sudo rsync -azv --delete-excluded --force /home/username/servername/ -e ssh

copy to server

sudo rsync -azv --delete-excluded --force -e ssh /home/username/servername

copy from server

Rsync Command Example Using Non-Standard SSH Port

assuming your remote server ssh port has been changed

sudo rsync -azv  /home/username/servername/ -e "ssh -p xxxx"
Rsync Command Example No Password / authorized_keys
sudo rsync -azv -e “ssh -i /home/username/.ssh/id_rsa” /home/username/server_backup_on_local_desktop

You may also like...