Copiying /etc/shadow with sudo and rsync

2009-11-24 Thread Gerard Mensoif
Hello,

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 
u...@localhost:/etc/shadow u...@server2:/etc/shadow 

but I get this error :
rsync: mkstemp /home/user/u...@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?

Regards
Gerard



  
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: Copiying /etc/shadow with sudo and rsync

2009-11-24 Thread Wayne Davison
On Tue, Nov 24, 2009 at 1:49 AM, Gerard Mensoif mensoif_ger...@yahoo.frwrote:

 rsync  --rsync-path='sudo rsync' --rsh='/usr/bin/ssh -x' --archive
 u...@localhost:/etc/shadow u...@server2:/etc/shadow


One end of the transfer has to be local (even a host named localhost is
not local), so one thing you can do is to use two rsync commands (pull, then
push).  Or just make sure that the sending side of the transfer is running
rsync as root (e.g. use sudo to run the local rsync too).

Also, a modern rsync would have exited with an error about your invalid
two-server syntax, so you may wish to upgrade to something newer.

..wayne..
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html