Some help with sudo on remote side of rsync

Michal Soltys soltys at
Wed Jan 28 22:49:04 GMT 2009

Carney Mimms wrote:
> I am now able to ssh from remote to local and local to remote without 
> passwords using RSA keys, but if I run the script without sudo, i.e. 
> Sudo /usr/local/bin/rsync ... It can’t copy files that need root 
> permissions. If I leave out the sudo and run the script after becoming 
> root (sudo su), I get prompted for a password again.

When you become root, ssh will try to read keys from the home directory
proper for a new uid, regardless of the $HOME setting. The same happens 
when you specify "sudo rsync" remotely. If you setup the keys properly 
for root and allow it to login using ssh (eg. PermitRootLogin 
without-password), it should work fine.

More information about the rsync mailing list