Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, Here's my problem : I'm setting up a script on a Server that use rsync over ssh like .... rsync -avzSH --delete --perms -e ssh $SOURCE $USER@$DEST_HOST:$DEST .... $USER ...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    6

    Unhappy rsync over ssh as non-root user

    Hi,
    Here's my problem :
    I'm setting up a script on a Server that use rsync over ssh like
    ....
    rsync -avzSH --delete --perms -e ssh $SOURCE $USER@$DEST_HOST:$DEST
    ....

    $USER in the rsync command is a non-root user, I want to preserve ownership and permissions of the $SOURCE directory to $DEST

    I notice when I use root instead of $USER the --perms parameter just work fine, but when I use my-normal $USER, all $DEST files and subdirectories get the $USER perms.

    Did some know how to work this out without having to use root user for this Job.


    NOTE : the user $USER have full perms in $DEST folder.

    Thanks 4 help.

  2. #2
    Just Joined!
    Join Date
    Feb 2008
    Posts
    29
    use the -p option,

    i.e rsync -avzp

    that should preserve permissions.

  3. #3
    Just Joined!
    Join Date
    Feb 2008
    Posts
    6
    Thanks Legolasz, but the -p do the same thing "--perms" did in my exemple.

    I think I found where the problem is : to preserve permissions (-p or --perms) rsync work just like chown in the remote host, that mean I have to execute my script as root, otherwise permissions can't be preserved.

    I still don't figure out a good solution coz I have no choice but using a non-root user for my task.

    The only solution I found is setting the SUID in /usr/bin/rsync ; but I'm not gonna use this one because I have to face a security whole that way.

  4. #4
    Just Joined!
    Join Date
    Feb 2008
    Posts
    29
    Whoa I missed --perms. Sorry.

  5. #5
    Just Joined!
    Join Date
    Feb 2008
    Posts
    6

    rsync over ssh as non-root user

    If this can help someone, I found a better solution than making the suid on rsync :

    Give the user ($USER) that will run rsync a sudo access to /usr/bin/rsync in the remote host and use the --rsync-path "sudo rsync" in your local script.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...