Linux tar permission denied

Tar go cannot mkdir permission denied

but i always get notification error where my wrong at? updated : based on @Jagadesh request, here’s the result of result i tried with @Jagadesh advice, so i run this : but it produce same thing like this : Solution: Finally (big thanks to @matigo), After do research, i change the permission on my windows into my users settings to full control, i do this with right click and setting on security based on this article https://www.laptopmag.com/articles/take-ownership-folder-windows-10-using-file-explorer Question: while installing binaries Solution: Its permission issue so go to home dir and install again, it worked for me. Because of that, doesn’t try to create the directory, nor tries to change the owner and group permissions of the directory, nor tries to restore the creation date of the directory.

Always get permission denied on tar. cannot mkdir: permission denied on my kafka installation

basically this is my question in stack overflow but not answered yet https://stackoverflow.com/questions/67708710/always-get-permission-denied-on-tar-cannot-mkdir-permission-denied-on-my-kafka

so i just downloaded kafka in binary files (.tgz) and i put that file into my directory /mnt/c:/Program Files/Kafka/

but when i want to un-tar that file with this code

tar -xvf kafka_2.13-2.8.0\ \(1\).tgz 

but i always get notification error

tar: kafka_2.13-2.8.0: Cannot Mkdir: Permission Denied

updated : based on @Jagadesh request, here’s the result of ls -al

i tried with @Jagadesh advice, so i run this :

chmod 755 /mnt/c/"Program Files (x86)"/"Kafka" 

but it produce same thing like this :

chmod: changing permissions of '/mnt/c/Program Files (x86)/Kafka' : permission denied 

Finally (big thanks to @matigo), After do research, i change the permission on my windows into my users settings to full control, i do this with right click and setting on security based on this article https://www.laptopmag.com/articles/take-ownership-folder-windows-10-using-file-explorer

How to solve TAR: CANNOT MKDIR PERMISSION DENIED, 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. Share. edited Feb 16, 2017 at 13:55. Shrinivas Patgar.

Bin: Cannot mkdir: Permission denied OR platform specific fabric binary is not available to download in Hyperledger Fabric

platform specific fabric binary is not available to download while installing binaries

tar: bin/peer: Cannot open: No such file or directory tar: config: Cannot mkdir: Permission denied tar: config: Cannot mkdir: Permission denied tar: config/core.yaml: Cannot open: No such file or directory tar: config: Cannot mkdir: Permission denied tar: config/configtx.yaml: Cannot open: No such file or directory tar: config: Cannot mkdir: Permission denied tar: config/orderer.yaml: Cannot open: No such file or directory tar: Exiting with failure status due to previous errors

Its permission issue so go to home dir and install again, it worked for me. If someone can tell me how to get permission at same path please tell me

Читайте также:  Astra linux гибридная графика

Always get permission denied on tar. cannot mkdir, Not having sufficient permission to create directory, execute chmod 755 to the directory where the tar is placed.. or else switch to the user which has the permission.. Can you execute ls -al and post it here, so that can analyze much deeper and help – Jagadesh

Permission with tar command

I have some problem with linux «tar» command.I want to unzip a config001.gz to a directory(with owner root ,group root and 777 permission as show in pic).

My origin dir and target dir is shown in pic.
My question is:

  • why there is en empty folder in a config001.gz file(I try to tar two file together and look in the the config002.tgz file ,there is no empty dir)?
  • if I don’t append —no-overwrite-dir after command,it will raise error, what permission does «tar» want to change?
  • why —no-overwrite-dir option can fix the problem

my mount infomation: fuse.mfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0

why there is en empty folder in a config001.tgz file?

There is the «root folder» included in the tar archive. The folder the tar was in. The privileges, owner and group, permissions and creation/modification (or one of them, I am not sure) dates are included. You can create such archive with:

mkdir -p /tmp/a cd /tmp/a echo 123 > 1 echo 234 > 2 tar cfvp /tmp/test.tar . # and inspect with: tar -tvf ./test.tar drwxr-xr-x kamil/kamil 0 2019-07-15 12:50 ./ -rw-r--r-- kamil/kamil 4 2019-07-15 12:50 ./2 -rw-r--r-- kamil/kamil 4 2019-07-15 12:50 ./1 

By specifing the . , ie. the current directory, the information about the current directory itself will be included in he tar . Ie. the information about the owner and group, permissions and dates.

if I don’t append —no-overwrite-dir after command,it will raise error, what permission does «tar» want to change?

tar wants to change the permissions of the directory you are inside. The hpc_dir directory. The hpc_dir is owned by root , so tar can’t change/touch it.

why —no-overwrite-dir option can fix the problem?

Because then tar sees the the currect directory hpc_dir exists. Because of that, tar doesn’t try to create the directory, nor tries to change the owner and group permissions of the directory, nor tries to restore the creation date of the directory.

Читайте также:  Виды командных оболочек linux

You could just go with mkdir somedir; tar xzfv archive.tar -C somedir — that way the somedir will be created by current user, so tar will be able to change it’s properties.

Or you could just change the owner of hpc_dir directory, letting your user modify it.

How to solve tar: jdk1.8.0_102: Cannot mkdir, To discard any issue with permissions, try to move the file to /opt mv tar zxf jdk-8u102-linux-x64.tar.gz /opt, give it all permissions chmod 777 tar zxf jdk-8u102-linux-x64.tar.gz and then execute tar zxf jdk-8u102-linux-x64.tar.gz from there – Zumo de Vidrio

Источник

tar command create directory without 777 permission

I run into an error while extracting a tar file, the created directory are created with the chmod 666 instead of 777. Therefore it will not extract inside this folder. Here is my command:

$umask 000 && tar -xvzf compress.tgz tar: dist/assets: Cannot mkdir: Permission denied tar: dist/assets/favicon.ico: Cannot open: Permission denied $ls -ll drw-rw-rw- 2 user grp 4096 Mar 14 16:43 assets 

I used this module on local to compress the file: https://www.npmjs.com/package/tar When I create a directory with mkdir it gives 777 mode, what am I missing? As requested:

-bash-4.2$ tar tzvf compress.tgz drw-rw-rw- 0/0 0 2018-03-15 12:17 dist/ -rw-rw-rw- 0/0 13117 2018-03-15 12:17 dist/3rdpartylicenses.txt drw-rw-rw- 0/0 0 2018-03-15 12:17 dist/assets/ 

@thebtm let’s say I have a folder with one file inside dist/assets/favicon.ico. When extracting I got only one folder dist with 666 mode and nothing inside. Also it output the errors above.

@Carpette never say never. I can think of several scenarios where 777 is an appropriate permission mode.

@RonJohn during the tar it create the subfolder but they haven’t the right chmod so the subfolder and subfiles aren’t created.

2 Answers 2

As you can see from the output of tar tv the permissions in the archive itself are broken. If you have any control over the tool that created this archive I would strongly recommend that you fix it, or report a bug.

I assume you still need to extract the files from the broken archive. Try this:

tar xzvf compress.tgz --delay-directory-restore find dist -type d -exec chmod a+x <> \; 

(We can’t use a trailing + in this instance because the chmod must be applied one directory at time so that find can descend into the fixed subdirectories. The semicolon is prefixed with a backslash so that it’s not treated by the shell as a special character, but rather it’s passed to the find. -exec as a literal.)

Читайте также:  Дистрибутив линукса для роутера

With star (from schily-tools ), you can extract it with:

star xf file.tgz -no-p -find -type d -chmod a+x 

To add the execute permission (for everybody) to the extracted directories to fix those bogus permissions in the archive.

With -no-p , the umask is also applied even if run as root, which assuming your umask is at least 002 would also fix those too wide write permissions (note that the umask takes precedence over the -chmod ).

Note that none of the GNU tar , bsdtar nor star implementations of tar in my test have any issue extracting an archive with such broken permissions. Most likely here, you’re trying to extract it while there was already a dist directory without search permission (because for instance you have extracted a similar archive with similarly broken permissions).

You’d need to fix those permissions first before extracting the archive.

Источник

Simon Krenger

This is some additional paragraph placeholder content.

This is some additional paragraph placeholder content.

Linux tar: Cannot change ownership to [..]: Permission denied

In a script I was working on, the tar command always reported the following error when I tried to extract an archive:

Cannot change ownership to uid 1000 , gid 1000: Permission denied

But I was executing the script as root! The reason for this error to occur turned out to be relatively simple. Hint: It has to do with CIFS.

The command in the script looked something like this:

# tar xzf $INPUT_FOLDER/archive.tar.gz -C /mnt/test-nas/[..]

So tar tried to extract the contents of the archive to /mnt/test-nas/[..] and failed (even as root). It turns out that tar tries to preserve the file permissions when run as root:

 -p, --preserve-permissions, --same-permissions extract information about file permissions (default for superuser)

Since the filesystem /mnt/test-nas/ was mounted via SMB, even root had trouble setting the correct permissions and therefore failed. You can get around this problem by specifying —no-same-owner , so tar won’t try to set an owner:

# tar xzf $INPUT_FOLDER/archive.tar.gz --no-same-owner -C /mnt/test-nas/[..]

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Источник

Оцените статью
Adblock
detector