Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Fİrst of all I am sorry for my noob question. I am really new to Unix based OS. 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

canserhan@embserv:/usr/src$ 

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.

Thank you for your help.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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.

share|improve this answer
    
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? –  Amadeus Bachmann May 14 '12 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 '12 at 20:31
    
Vielen, herzlichen Dank! –  Amadeus Bachmann May 14 '12 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.) –  Danny Englander Nov 9 '12 at 15:54
add comment

Your Answer

 
discard

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.