change UID+GID on target system?

Voelker, Bernhard bernhard.voelker at siemens-enterprise.com
Wed Jun 20 05:21:48 MDT 2012


Uwe Brauer wrote (June 20, 2012 12:57 PM):
 
> >> On Tue, 19 Jun 2012 13:50:00 +0000, "Voelker, Bernhard"
> >> <bernhard.voelker at siemens-enterprise.com> wrote:
>
>    >> Oh I see misunderstanding then. So what you propose is
>    >> basically a chown of the directory in question?
>
>    > no.
>
>
> Why not? I am confused.
>
> If I do, as user1 knowing passwd user2 
> Laptop1 
>  rsync -auvz /home/oub/sourcedir user2 at localhost:/media/disk/targetdir
>
> I have copied the content of sourcedir to target dir on USB,
> and owner (UID+GID) is now user2
>
> But if as user1 on Laptop1 I do
>
>  rsync -auvz /home/oub/sourcedir /media/disk/targetdir
>
> sudo chown -R  user2 /media/disk/targetdir
> sudo chgrp -R  user2 /media/disk/targetdir
>
> I obtain  the same result

Ok, the result is the same, but under the hood, there's no chown
in the user2 at localhost case.
And you need root rights for chown while you can savely work
without elevated priviledges with user2's pw.

> Anyhow the problem is from Laptop2 to the USB, I would need
> user2 passwd.

no, on Laptop2, you just use oub user ... which has id=1002
and therefore is the owner of the files on the USB drive.
That was the goal of the rsync-via-ssh-to-user2 at localhost step
to have all files owned by 1002.

> I think it is best to have the same UID+GID on
> both machines.

well, probably easier.

>    > BTW: Why do you need it on the USB drive? I.e. why don't you
>    > directly rsync from Laptop1 to Laptop2?
>
> Because the connection is very unreliable, laptop 2 has a
> dynamic IP, and I am paranoiac and don't want to have 
>
> sshd: ALL
>
> in hosts.allow on Laptop1

A bad connection is THE argument, admitted.
But I still don't understand why you need to
modify hosts.allow. I guess you have changed
the settings from the default.
I'd use a Firewall to permit this explicitly.

Have a nice day,
Berny


More information about the rsync mailing list