[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rsync
Subject:    Re: rsync using sudo via remote shell
From:       Julian Cowley <julian () lava ! net>
Date:       2004-08-31 21:33:05
Message-ID: Pine.LNX.4.58.0408311119330.12174 () taurus ! cesta ! com
[Download RAW message or body]

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" backup@server:/
> > /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' \
> backup@server:/ /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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic