Copiying /etc/shadow with sudo and rsync

Gerard Mensoif mensoif_gerard at
Tue Nov 24 02:49:22 MST 2009


I have 2 server, which must rsync some files, including /etc/passwd and
/etc/shadow. Everything was working fine until we decided to forbid
rootlogin on the server, and use sudo for the sync. My problem is that
/etc/shadow has a file permission of 400, so the non privilegd user can
not read it, so I can use a command like this:
rsync  --rsync-path='sudo rsync' --rsh='/usr/bin/ssh -x' --archive user at localhost:/etc/shadow user at server2:/etc/shadow 

but I get this error :
rsync: mkstemp "/home/user/user at server2:/etc/.shadow.wBWPkX" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at main.c(1146)

does somebody know a workaround, or an alternative (and secure) solution?



More information about the rsync mailing list