Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Do not sleep in a eucalyptus tree tonight.


comp / comp.unix.questions / Re: Retaining file permissions while copying between Unix systems

SubjectAuthor
* Retaining file permissions while copying between Unix systemsTuxedo
`* Re: Retaining file permissions while copying between Unix systemsCasper H.S. Dik
 `- Re: Retaining file permissions while copying between Unix systemsHelmut Waitzmann

1
Subject: Retaining file permissions while copying between Unix systems
From: Tuxedo
Newsgroups: comp.unix.questions
Organization: solani.org
Date: Tue, 18 Sep 2018 07:58 UTC
Path: eternal-september.org!news.eternal-september.org!reader01.eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: tuxedo@mailinator.com (Tuxedo)
Newsgroups: comp.unix.questions
Subject: Retaining file permissions while copying between Unix systems
Date: Tue, 18 Sep 2018 09:58:57 +0200
Organization: solani.org
Lines: 38
Message-ID: <pnqbg2$grd$1@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7Bit
X-Trace: solani.org 1537257794 17261 127.0.0.43 (18 Sep 2018 08:03:14 GMT)
X-Complaints-To: abuse@news.solani.org
NNTP-Posting-Date: Tue, 18 Sep 2018 08:03:14 +0000 (UTC)
User-Agent: KNode/4.10.5
X-User-ID: eJwFwQkBwDAIA0BLhHeVA83wL6F3YYm85RnpsbGnBxKr4ijSrgkpwjE1cfXBn+drOMnCsB8RzBEG
Cancel-Lock: sha1:nv1BWbFSM7uDjYtS3kpkHLYjYE0=
View all headers

Hello,

In copying a directory which contains files and sub-directories and symlinks
from one system to another, to retain symlinks as symlinks, I usually enter
the directory on the sending system and extract it on the receiving system
as follows:

tar cf - * | ssh user@host '(cd /path/to/directory;tar xf - )'

File permissions are mostly kept on the receiving system as their originals.
For example, when in the sending system there's a file:

-rwxr-xr-x 1 tuxedo tuxedo 9126 Sep 16 09:56 hello.cgi

.... it ends up in the same way on the target system:

-rwxr-xr-x 1 tuxedo users 9126 Sep 16 09:56 hello.cgi

But where there's a file (or directory) with 777 permissions on the sending
system, as:
-rwxrwxrwx 1 tuxedo tuxedo 3264 Sep 18 08:40 log.txt

.... its group and world permissions on the receiving system do not become
writeable:
-rwxr-xr-x 1 tuxedo users 3264 Sep 18 08:40 log.txt

There is no group named tuxedo on the receiving system, but even if I create
one and make tuxedo a member of it and then redo the tar/ssh procedure, the
write file permissions are still missing on the receiving system.

While there's no problem to fix these file permissions manually on the
receiving system, it could be better automatically.

How can this be done and why do group and world permissions end up different
on the receiving system?

Many thanks,
Tuxedo

Subject: Re: Retaining file permissions while copying between Unix systems
From: Casper H.S. Dik
Newsgroups: comp.unix.questions
Date: Tue, 18 Sep 2018 08:21 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!reader01.eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Newsgroups: comp.unix.questions
Subject: Re: Retaining file permissions while copying between Unix systems
References: <pnqbg2$grd$1@solani.org>
From: Casper.Dik@OrSPaMcle.COM (Casper H.S. Dik)
User-Agent: nn/6.6.2
Date: 18 Sep 2018 08:21:20 GMT
Lines: 25
Message-ID: <5ba0b580$0$32256$e4fe514c@news.xs4all.nl>
NNTP-Posting-Host: 016fe8d7.news.xs4all.nl
X-Trace: G=42kiAHDW,C=U2FsdGVkX18ozR5IlJsM38asw4rspUXj/vqy9BOJS2l6+v9qHTgpE5R2/eUhwEWJtSeTOu6hVqYjwe+1CJ5Og/RTUVhg/+fCrVdnCfJCXjQ=
X-Complaints-To: abuse@xs4all.nl
View all headers

Tuxedo <tuxedo@mailinator.com> writes:

>In copying a directory which contains files and sub-directories and symlinks
>from one system to another, to retain symlinks as symlinks, I usually enter
>the directory on the sending system and extract it on the receiving system
>as follows:

>tar cf - * | ssh user@host '(cd /path/to/directory;tar xf - )'

>File permissions are mostly kept on the receiving system as their originals.
>For example, when in the sending system there's a file:

You want to use "p" when extracting.

tar cf - * | ssh user@host '(cd /path/to/directory;tar xpf - )'

Generally, tar will create a file with the permissions in the archive,
however the system will apply the umask (likely 022) and apply that so
a file mode 777 will be extracted in mode 755.

With "-p" it should take the original modes.

Casper

Subject: Re: Retaining file permissions while copying between Unix systems
From: Helmut Waitzmann
Newsgroups: comp.unix.questions
Organization: albasani.net
Date: Tue, 18 Sep 2018 12:51 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!reader01.eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.albasani.net!.POSTED!not-for-mail
From: nn.throttle@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.questions
Subject: Re: Retaining file permissions while copying between Unix systems
Date: Tue, 18 Sep 2018 14:51:21 +0200
Organization: albasani.net
Lines: 34
Message-ID: <87bm8vm0ik.fsf@helmutwaitzmann.news.arcor.de>
References: <pnqbg2$grd$1@solani.org>
<5ba0b580$0$32256$e4fe514c@news.xs4all.nl>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.albasani.net Fr+8lKe9mOhuTH7XQfIrK2kvkZSUzoMZtVOYJR7z9c7PLo5WbW9GF3NJ2uqvhCBSLx8sL8u8Kr/AE0bcabaAL+mlVN6VBdshSdyeH8DCJx+x55dnaZAo1JpADlBpVKcs
NNTP-Posting-Date: Tue, 18 Sep 2018 12:51:23 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="qWn269Wb+i8ywLSgF+IF713YP2y7wEwrr2bQR5NxG4E2wXh46eEpL+aXElTI5RT7NibHEExqzIVustvBf7a11CAyym+XKGl8kqIjN2pAwW8b/uKm2iGV3NMbCQw0kQb7"; mail-complaints-to="abuse@albasani.net"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Cancel-Lock: sha1:+hzjO0E6oxdwIH+HjqSKMsFNXRI= sha1:dCQ1w1k3Azwwe/hKs3F/pIcVH0w=
Mail-Copies-To: nobody
View all headers

Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM>:

>You want to use "p" when extracting.
>
> tar cf - * | ssh user@host '(cd /path/to/directory;tar xpf - )'
>
>
>Generally, tar will create a file with the permissions in the archive,
>however the system will apply the umask (likely 022) and apply that so
>a file mode 777 will be extracted in mode 755.

Yes, but I've seen a version of GNU tar, which explicitly
substracts the umask from the permissions in the archive and
supplies the result to the “mode” parameter of the “creat” or
“open” system call.

The difference can be seen, when extracting to a directory, which
has got a default access control list: If there is a default
access control list, the operating system ignores the umask, when
creating inodes (files or directories), but uses the default access
control list to limit the effect of the “mode” parameter.

>With "-p" it should take the original modes.

Yes. That's true, even if there is a default access control iist:
When given the “-p” option, “tar” explicitly calls the “chmod”
system call after having extracted an archive member. As the
“chmod” system call is not affected by a default access control
list, “tar” will set the permissions as recorded in the archive,
when given the “-p” option.

1

rocksolid light 0.9.8
clearnet tor