rsync using sudo.

Mikkel L. Ellertson mikkel at infinity-ltd.com
Sun Feb 1 01:54:55 UTC 2009


gary artim wrote:
> /usr/bin/rsync --stats -ae "ssh" --rsync-path="sudo /usr/bin/rsync"
> /my  rsync at host1:/backup/my
> 
> I'm running the above command as user rsync (on both the local and
> remote system). Both rsync
> users are in /etc/sudoers and permitted to run the command as root
> /usr/bin/rsync and I have
> ssh-kegen stuff setup correctly.  tested aka: ssh host1 who (no passwd
> asked for)
> 
> The problem: the local files get permission denied on root owned files
> subdirs. If I add
> sudo /usr/bin/rsync --stats -ae "ssh" --rsync-path="sudo
> /usr/bin/rsync" /my  rsync at host1:/backup/my
> 
> I get prompted for a ssh passwd. Has anyone solved or done this?
> 
> Any help would be great!
> 
> -- Gary
> 
You could try the -E option of sudo when using the second form.

-E  The -E (preserve environment) option will override the env_reset
option in sudoers(5)). It is only available when either the matching
command has the SETENV tag or the setenv option is set in sudoers(5).

This should preserve your ssh=agent settings. Now, if you are using
a private key without a password, you can add the key to roots
secure keyring. Then you should not need the -E option...

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090131/407f35a1/attachment-0001.sig>


More information about the fedora-list mailing list