browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

rsync over ssh with sudo

Posted by on December 10, 2008

I prefer to use rsync to scp as it allows you to both resume downloads, or re-copy content while only transfering the changed files. Often though, you need to have root priv on the remote machine.
I found the following quick fix to work wonders.

Step 1: Enter your sudo password on the remote machine:

stty -echo; ssh user@remote-host sudo -v; stty echo

Thanks to the per tty ticketing in sudo, subsequent connections within a short timeout will not need to re-enter the sudo password.

Step 2: rsync your files:

rsync -avP –rsync-path=’sudo rsync’ user@remote-host:dir .

Comments are closed.