bsdtar and ACLs

cpet cpet at sdf.org
Thu Feb 19 20:25:37 UTC 2015


On 2015-02-19 14:16, Toomas Aas wrote:
> Hello!
> 
> I was under impression that bsdtar should, by default, preserve
> filesystem ACLs. However, this is not the case here, as seen by the
> following test. What am I missing?
> 
> # touch testfile.txt
> # setfacl -m u:user2:rwx testfile.txt
> # getfacl testfile.txt
> # file: testfile.txt
> # owner: root
> # group: users
> user::rw-
> user:user2:rwx
> group::rw-
> mask::rwx
> other::r--
> # ls -l testfile.txt
> -rw-rwxr--+ 1 root  users  0 Feb 19 22:07 testfile.txt
> # tar cvf testfile.tar testfile.txt
> a testfile.txt
> # rm testfile.txt
> # tar xvf testfile.tar
> x testfile.txt
> # ls -l testfile.txt
> -rw-rwxr--  1 root  users  0 Feb 19 22:07 testfile.txt
> # getfacl testfile.txt
> # file: testfile.txt
> # owner: root
> # group: users
> user::rw-
> group::rwx
> other::r--
> # uname -a
> FreeBSD hostname.tld 10.1-RELEASE-p4 FreeBSD 10.1-RELEASE-p4 #0
> r277235: Mon Jan 19 21:37:54 EET 2015
> toomas at hostname.tld:/usr/obj/usr/src/sys/SPUTNIK  amd64
> # tar --version
> bsdtar 3.1.2 - libarchive 3.1.2

  -p, --insecure, --preserve-permissions
	     (x	mode only) Preserve file permissions.  Attempt to restore the
	     full permissions, including owner,	file modes, file flags and
	     ACLs, if available, for each item extracted from the archive.
	     This is the default, if tar is being run by root and can be over-
	     ridden by also specifying --no-same-owner and
	     --no-same-permissions.



More information about the freebsd-questions mailing list