Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to solve TAR: CANNOT MKDIR PERMISSION DENIED

File permissions

I have a file data.tgz which I want to uncompress.

-rw-r--r-- 1 username group 20342951248 mai 18 11:50 data.tgz


Directory permissions

Directory where file is located

drwxrwxr-x 3 username group 4096 juin 1 17:16 directory/


Uncompress

When I try to uncompress the file by using the following command:

tar - xzf data.tgz 

I get the following error:

tar: data : CANNOT MKDIR PERMISSION DENIED
tar: data/a-m-00004.nt.gz : open impossible: No such file or directory

When I use tar -xzvf data.tgz I get the following errors


Errors

tar: data : mkdir impossible: Permission non accordée
tar: data/a-m-00013.nt.gz : open impossible: Aucun fichier ou dossier de ce type
data/a-m-00012.nt.gz
tar: data : mkdir impossible: Permission non accordée
tar: data/a-m-00012.nt.gz : open impossible: Aucun fichier ou dossier de ce type
data/a-m-00015.nt.gz
tar: data : mkdir impossible: Permission non accordée
tar: data/a-m-00015.nt.gz : open impossible: Aucun fichier ou dossier de ce type
data/a-m-00014.nt.gz
tar: data : mkdir impossible: Permission non accordée
tar: data/a-m-00014.nt.gz : open impossible: Aucun fichier ou dossier de ce type
data/a-m-00017.nt.gz
tar: data : mkdir impossible: Permission non accordée
tar: data/a-m-00017.nt.gz : open impossible: Aucun fichier ou dossier de ce type
data/a-m-00016.nt.gz
tar: data : mkdir impossible: Permission non accordée
tar: data/a-m-00016.nt.gz : open impossible: Aucun fichier ou dossier de ce type
data/a-m-00019.nt.gz

Google translation

tar: data: mkdir impossible not granted Permissions
    tar: data / am-00013.nt.gz: Can not open: No such file or folder of this type
    data / a-m-00012.nt.gz
    tar: data: mkdir impossible not granted Permissions
    tar: data / am-00012.nt.gz: Can not open: No such file or folder of this type
    data / a-m-00015.nt.gz
    tar: data: mkdir impossible not granted Permissions
    tar: data / am-00015.nt.gz: Can not open: No such file or folder of this type
    data / a-m-00014.nt.gz
    tar: data: mkdir impossible not granted Permissions
    tar: data / am-00014.nt.gz: Can not open: No such file or folder of this type
    data / a-m-00017.nt.gz
    tar: data: mkdir impossible not granted Permissions
    tar: data / am-00017.nt.gz: Can not open: No such file or folder of this type
    data / a-m-00016.nt.gz
    tar: data: mkdir impossible not granted Permissions
    tar: data / am-00016.nt.gz: Can not open: No such file or folder of this type
    data / a-m-00019.nt.gz
like image 454
Hani Goc Avatar asked Jun 01 '15 15:06

Hani Goc


People also ask

How do I fix mkdir permission denied?

[ErrorException] mkdir(): Permission denied. That means you do not have write permission on your project folder. Create a new folder, say 'myproject and run sudo chmod 777 myproject . Then move to 'myproject' folder and create project.

Why I Cannot create a directory permission denied?

If you receive an error telling you that you do not have permissions to create a directory or to write a file to a directory, this is likely an indication that your script is attempting to write to a directory that you do not own.

Can not Create Directory Permission denied Linux?

Resolving The Problem Simply log in as super user “su” and use “chmod 777” to set the directory permissions of where you wish the rational directory to be created. Once done, you can re-enter the original directory again and the install will continue using the same directory.


1 Answers

You are trying to uncompress in a path you don't have write access to. Try running this command to extract in your user's home directory: tar -xzf data.tgz /home/yourusername

Or try with sudo i.e. sudo tar -xzf data.tgz

like image 154
Caleb Adams Avatar answered Oct 12 '22 23:10

Caleb Adams