I need to to create a archive from my ftp server (all of the /usr/src/ directory) using tar command. However I keep getting permission denied error. Here is step by step what I am doing:

canserhan@embserv:~$ cd /usr/src/

canserhan@embserv:/usr/src$ ls
kernel-headers-2.6.8-2       linux                rtlinux-3.2-pre3
kernel-headers-2.6.8-2-386   linux-2.4.21         rtlinux3.2-move
kernel-kbuild-2.6-3          linux-2.6.9-rtlfree
kernel-source-2.6.8.tar.bz2  rtlinux

canserhan@embserv:/usr/src$ tar cvf rtl_archive.tar /usr/src/
tar: rtl_archive.tar: Cannot open: Permission denied
tar: Error is not recoverable: exiting now


What I am doing wrong? Seems like the problem is with my output archive file. But I could not exactly figure out what should I do.

1 Answer 1


The problem is that you are executing the command inside /usr/src to which you do not have write permissions with your credentials. Therefore you do not have write permissions for the .tar file you are trying to create. Use tar cvf /tmp/rtl_archive.tar /usr/src to create a tar-file where writing is possible.

Generally you can give any path that you have write access to, such as:

tar cvf $HOME/rtl_archive.tar /usr/src

to create the .tar file in.

  • I really appreciate your help. It seems like it worked, it created a rtl_archive under /tmp/ however I got an error during the operation: "tar: Error exit delayed from previous errors " How can I fix this? May 14, 2012 at 15:16
  • 1
    See this similar question: askubuntu.com/questions/58144/… Probably there is something in the directories that cannot be included in a tar-file (such as a pipe). This is not a critical error, so tar continues. Do not use the v parameter (tar cf /tmp/rtl_archive.tar /usr/src) to reduce the output - you should then see the "real" error.
    – Thomas
    May 14, 2012 at 20:31
  • Vielen, herzlichen Dank! May 14, 2012 at 22:44
  • Thanks, I ran into the same issue and this method works great! (I didn't want to start messing with the existing permissions on the directory itself.) Nov 9, 2012 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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