Remote backup using rsync

To backup files on a remote server with sudo priviledges (on the server) first add the following into the /etc/sudoers file:

ALL= NOPASSWD:/usr/bin/rsync

Then backup the files from the local machine using:

rsync -atz -e "ssh" --rsync-path="sudo rsync" ./local_directory user@server:/path_to_backup
Advertisements