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.

1 Answer

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.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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