Casper H.S. Dik <Caspe...@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.