tar: cannot mkdir permission denied

tar, by default, should handle the restoration of directory permissions correctly so that the files can be extracted within subdirectories as well as the original permissions of those subdirectories are restored as in the archive, but sometimes it fails. It might be when extracting from an incrementally created archive.

tar xf ../r2013b.tar
...
tar: r2013b/archives/common: Cannot mkdir: Permission denied
tar: r2013b/archives/common/3p/tablelayout_common_1372719204.xml: Cannot open: No such file or directory
tar: r2013b/archives/common: Cannot mkdir: Permission denied
tar: r2013b/archives/common/3p/._tex-archive_common_1360092817.enc: Cannot open: No such file or directory
tar: r2013b/archives/common: Cannot mkdir: Permission denied
tar: r2013b/archives/common/3p/tex-archive_common_1360092817.enc: Cannot open: No such file or directory
...

Then it’s required to have tar to delay the permission restoration after extracting all files by giving --delay-directory-restore option:

tar -x --delay-directory-restore -f ../r2013b.tar

See this for the default behaviour of tar.

Advertisements
tar: cannot mkdir permission denied

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s