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.

tar: cannot mkdir permission denied