Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a file system backup in a tar archive, created with:

cd / && tar -cpz -f mybackup.tgz usr/local

Doing a

tar tvzf mybackup.tgz 


-rw-rw-r-- otto/otto      450 2010-04-15 22:08 usr/local/alpha-4.5/pkg/conf/PLATFORM/sparc
drwxr-xr-x otto/otto        0 2009-04-01 08:08 usr/local/alpha-4.5/pkg/ui/
drwxr-xr-x otto/otto        0 2009-04-01 08:08 usr/local/alpha-4.5/pkg/ui/src/
drwxr-xr-x otto/otto        0 2009-04-01 08:08 usr/local/alpha-4.5/pkg/ui/src/thyc/
-rw-r--r-- otto/otto     2416 2001-01-13 16:01 usr/local/alpha-4.5/pkg/ui/src/thyc/vid45
-rw-r--r-- otto/otto      569 2001-01-13 16:01 usr/local/alpha-4.5/pkg/ui/src/thyc/vid46

however, extracting like this:

tar xvpz -f mybackup.tgz 

results in the following permissions:


-rw-rw-r-- 4 otto otto  450 2010-04-15 22:08 usr/local/alpha-4.5/pkg/conf/PLATFORM/sparc
drwx------ 4 root root  4.0K 2011-03-27 23:20 usr/local/alpha-4.5/pkg/ui/
drwxr-xr-x 7 otto otto  4.0K 2009-04-01 08:08 usr/local/alpha-4.5/pkg/ui/src/
drwxr-xr-x 7 otto otto  4.0K 2009-04-01 08:08 usr/local/alpha-4.5/pkg/ui/src/thyc/
-rw-r--r-- 4 otto otto  2416 2001-01-13 16:01 usr/local/alpha-4.5/pkg/ui/src/thyc/vid45
-rw-r--r-- 4 otto otto  569 2001-01-13 16:01 usr/local/alpha-4.5/pkg/ui/src/thyc/vid46


Notice the second line. For some reason, the directory is now owned by root and the permissions have changed to 700. Its children, who have the same original permissions as their parent, are created with the correct permissions. This is just an excerpt, this is all over the place in the extracted backup.

What could cause this?


share|improve this question
Are you using the same version of tar to backup and restore? Are your source and destination arches the same, or different? – Steven Monday Mar 27 '11 at 23:17
Yes, same machine, same tar. The archive is only about a month old. – Frank Brenner Mar 27 '11 at 23:42
Are you running this as root? – Andrew Mar 28 '11 at 3:21
Yes, I am running this as root. – Frank Brenner Mar 28 '11 at 7:39
If you create the archive with tar zcvf, does the output look correct? You don't need the p flag when creating the archive. What filesystem is it? – MattBianco Mar 31 '11 at 13:03
up vote 3 down vote accepted

Sounds like a bug in tar to me. Which version are you using? If it's GNU tar you can find out with tar --version. The NEWS file for GNU tar version 1.24 mentions some fixes for bugs relating to permissions, which could be the problem.

share|improve this answer
Ah ... just ran into the same bug, thanks. – Samuel Lampa Jun 9 '11 at 13:26
I also noticed one thing while testing a lot of combinations of tar 1.15 an 1.23: The wording in the bug report gives the impression that it affects unpacking only, not the packing ... but my testing shows that packing is also affected. That is, files tar:ed with 1.15 will don't get their original owner (nor permissions, I believe) even if unpacked with tar newer 1.23. – Samuel Lampa Jun 9 '11 at 13:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.