You are not logged in.

#1 2017-01-19 20:58:49

ttoirrah
Member
Registered: 2015-01-29
Posts: 35

tar -xattrs (create then extract) isn't preserving extended attribute

$ getcap /usr/bin/ping
/usr/bin/ping = cap_net_raw+ep

- so clearly, I should follow the advice given in Full System Backup with tar to use -xattrs when backing up and later restoring my Arch system. But I've discovered that, at least on my Arch install, tar 1.29-2 [core] (x86_64) isn't re-installing ping with it's extended attribute, such that ping then won't work without sudo.

So I tested tar's functionality just on ping (doing the following either in /root or in my home directory):

tar --xattrs -czpvf ping.tar.gz /usr/bin/ping
tar --xattrs -xpf ping.tar.gz
getcap usr/bin/ping

- reports nothing - no extended attribute preserved. This would appear to make the Arch wiki advice to backup our systems with tar -xattrs seriously flawed.

By way of further exploration, I booted up from Knoppix and getcap on the Arch /usr/bin/ping correctly reports cap_net_raw+ep, but, as with Arch's tar, that isn't preserved after creating and extracting a tar with --xattrs.

Offline

#2 2017-01-19 21:50:54

loqs
Member
Registered: 2014-03-06
Posts: 13,968

Re: tar -xattrs (create then extract) isn't preserving extended attribute

Offline

Board footer

Powered by FluxBB