Running rsync with sudo
Rsync can probably be the best deployment tool (among other things) to use if you consider how fast and efficient it is. Lately however, I’ve run into issues on needing to rsync into directories that required sudo privileges, luckily google gave me a bit of help when figuring out how to do it.
Here is a version that simply sends sudo to the server and prepends rsync with sudo:
# run rsync with sudo stty -echo; ssh you@hostname 'sudo -v'; stty echo rsync -avz --rsync-path='sudo rsync' ~/location/on/your/computer you@hostname:~/location/on/server
You’ll obviously want to replace you@hostname and the location paths.
