Published on: September 20, 2014 by Arnold Pablo
There could be many situations where you do not have a root password for many of the servers you interact with where you can not SSH directly in as the root user. Also, the ssh daemons are wisely configured with ‘PermitRootLogin’ set to ‘no’ so a password would be moot anyway. Let us see how to use the rsync without root access in such situations.
Most probably you may have sudo permissions on the servers so that you can connect under your username and sudo the privileged commands as needed.
Set NOPASSWD in the /etc/sudoers file. Here we could have used the username instead of the wheel group
%wheel ALL= NOPASSWD:/usr/bin/rsync
Then use the –rsync-path option to specify the sudo wrapper.
rsync -a -e "ssh" --rsync-path="sudo rsync" email@example.com:/home/user/ /home/user
[root@b ~]# rsync -a -e “ssh” –rsync-path=”sudo rsync” firstname.lastname@example.org/home/user/ /home/user
Address xx.xx.xx.xx maps to tr.xxx.xx, but this does not map back to the address – POSSIBLE BREAK-IN ATTEMPT!
sudo: no tty present and no askpass program specified
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [receiver=3.0.6]
You may also get the same message, if the rsync command is not installed in the source server from which you are rsyncing and in such case, you would need to install rsync package.
Category : Howtos, Linux, Troubleshooting