rsync + ssh -o -p -g -l

Wayne Davison wayned at
Tue Mar 1 06:13:33 GMT 2005

On Mon, Feb 28, 2005 at 10:51:32PM -0600, michael mendoza wrote:
> rsync -avzpogl -e ssh archivoOrigen usuario at ipDestion:/dir2/
> but when a see in the new server, the data dont have the same permiss
> of owner, group than the old server.

The problem is that rsync need to be running as root in order to create
a file with different ownership than the login user.  So, you either
need to allow root to login via ssh and run rsync:

rsync -avzpogl -e ssh archivoOrigen root at ipDestion:/dir2/

Or, you need to pull the files as root from ipDestion, like this:

ssh -l usuario ipDestion
rsync -avzpogl -e ssh usuario at ipSource:/path/archivoOrigen /dir2/

As long as usuario has permissions to read the files, the latter command
will work fine (and root will be writing the files, so they will get
their ownership set correctly).

One other thing to keep in mind:  to preserve groups between machines,
you need to ensure that the /etc/group file has all the needed groups in
it on the destination machine or rsync will fall back to using the group
number without translation (which can sometimes cause a mismatch).


More information about the rsync mailing list