Executing rsync as sudo

A quick way to run rsync (via sudo on the remote server) is to use the –rsync-path option (asuming that sudo is configured to run without a password) also verify that you have !tty_tickets in your sudoers file.

rsync -avz --rsync-path='sudo rsync' user@server:/dir/to/backup /destination/directory/

To do this interactivly (without being able to do it password less)

user@bacup$ stty -echo;ssh user@server sudo -v; stty echo
user@bacup$ rsync -avz --rsync-path='sudo rsync' user@server:/dir/to/backup /destination/directory/

(Or as one line)

stty -echo; rsync -azv --rsync-path='sudo rsync' user@server:/dir/to/backup /destination/directory/; stty echo

“stty -echo” turns off input echo (so that your password will not be shown as you type it)
“stty echo” turns the input echo back on (so you can see what you are doing)