On Mon, 30 Aug 2004, Wayne Davison wrote: > On Mon, Aug 30, 2004 at 08:08:09PM +0200, Achim St?bler wrote: > > rsync -avz -e "ssh -i /home/backup/.ssh/id_dsa" [EMAIL PROTECTED]:/ > > /backup/server/ > > > > Unfortunately I can't figure out how to tell rsync to execute its remote > > instance via sudo. > > You can do this via the --rsync-path option: > > rsync -avz -e "ssh -i /home/backup/.ssh/id_dsa" --rsync-path='sudo rsync' [EMAIL > PROTECTED]:/ /backup/server/ > > You'll also want to make sure that sudo doesn't prompt for a password, > so you could start with a simpler command right before the rsync: > > ssh -i /home/backup/.ssh/id_dsa -l backup server sudo date
If you are doing this interactively (not part of a batch cronjob), an alternative to setting up sudo to not prompt for a password is to validate remotely. I usually do this: stty -echo; ssh remote sudo -v; stty echo I think sudo doesn't work this way if your sudo tickets are per-tty, so make sure you have !tty_tickets in your sudoers file. Then you can give the rsync command as above: rsync -av --rsync-path='sudo rsync' remote:dir . -- In the Year 2000 (tm)... "I will convert to Judasism and change my trademark Fa Shizzle My Nizzle to Sheiztle Fa Zeitzel." -- Snoop Dog -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
