tar command create directory without 777 permission
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
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/
I use --strip 1
to extract.
linux tar chmod gzip
 |Â
show 5 more comments
up vote
0
down vote
favorite
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/
I use --strip 1
to extract.
linux tar chmod gzip
4
you never, ever, ever need to have 777 rights.
â Carpette
Mar 14 at 17:22
@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.
â Frennetix
Mar 14 at 17:28
tar
does have ap
flag to preserve permissions however poor they may be
â thrig
Mar 14 at 17:34
1
@Carpette never say never. I can think of several scenarios where 777 is an appropriate permission mode.
â roaima
Mar 14 at 19:24
1
@RonJohn during the tar it create the subfolder but they haven't the right chmod so the subfolder and subfiles aren't created.
â Frennetix
Mar 15 at 16:33
 |Â
show 5 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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/
I use --strip 1
to extract.
linux tar chmod gzip
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/
I use --strip 1
to extract.
linux tar chmod gzip
edited Mar 15 at 11:27
asked Mar 14 at 17:18
Frennetix
1033
1033
4
you never, ever, ever need to have 777 rights.
â Carpette
Mar 14 at 17:22
@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.
â Frennetix
Mar 14 at 17:28
tar
does have ap
flag to preserve permissions however poor they may be
â thrig
Mar 14 at 17:34
1
@Carpette never say never. I can think of several scenarios where 777 is an appropriate permission mode.
â roaima
Mar 14 at 19:24
1
@RonJohn during the tar it create the subfolder but they haven't the right chmod so the subfolder and subfiles aren't created.
â Frennetix
Mar 15 at 16:33
 |Â
show 5 more comments
4
you never, ever, ever need to have 777 rights.
â Carpette
Mar 14 at 17:22
@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.
â Frennetix
Mar 14 at 17:28
tar
does have ap
flag to preserve permissions however poor they may be
â thrig
Mar 14 at 17:34
1
@Carpette never say never. I can think of several scenarios where 777 is an appropriate permission mode.
â roaima
Mar 14 at 19:24
1
@RonJohn during the tar it create the subfolder but they haven't the right chmod so the subfolder and subfiles aren't created.
â Frennetix
Mar 15 at 16:33
4
4
you never, ever, ever need to have 777 rights.
â Carpette
Mar 14 at 17:22
you never, ever, ever need to have 777 rights.
â Carpette
Mar 14 at 17:22
@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.
â Frennetix
Mar 14 at 17:28
@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.
â Frennetix
Mar 14 at 17:28
tar
does have a p
flag to preserve permissions however poor they may beâ thrig
Mar 14 at 17:34
tar
does have a p
flag to preserve permissions however poor they may beâ thrig
Mar 14 at 17:34
1
1
@Carpette never say never. I can think of several scenarios where 777 is an appropriate permission mode.
â roaima
Mar 14 at 19:24
@Carpette never say never. I can think of several scenarios where 777 is an appropriate permission mode.
â roaima
Mar 14 at 19:24
1
1
@RonJohn during the tar it create the subfolder but they haven't the right chmod so the subfolder and subfiles aren't created.
â Frennetix
Mar 15 at 16:33
@RonJohn during the tar it create the subfolder but they haven't the right chmod so the subfolder and subfiles aren't created.
â Frennetix
Mar 15 at 16:33
 |Â
show 5 more comments
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
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.)
-bash-4.2$ find dist -type d -exec chmod a+x + find: 'dist/assets': Permission denied
â Frennetix
Mar 16 at 10:36
@Frenentix please change the trailing+
to;
. I'll update my question too
â roaima
Mar 16 at 10:40
add a comment |Â
up vote
0
down vote
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.
1
You are correct, any decent modern tar implementation implements automated delayed directory setup for permissions and time stamps. When a directory is newly created during extraction, this is done with sane permissions and the permissions from the archive are applied later.
â schily
May 31 at 9:58
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
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.)
-bash-4.2$ find dist -type d -exec chmod a+x + find: 'dist/assets': Permission denied
â Frennetix
Mar 16 at 10:36
@Frenentix please change the trailing+
to;
. I'll update my question too
â roaima
Mar 16 at 10:40
add a comment |Â
up vote
2
down vote
accepted
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.)
-bash-4.2$ find dist -type d -exec chmod a+x + find: 'dist/assets': Permission denied
â Frennetix
Mar 16 at 10:36
@Frenentix please change the trailing+
to;
. I'll update my question too
â roaima
Mar 16 at 10:40
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
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.)
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.)
edited Mar 16 at 10:41
answered Mar 15 at 14:13
roaima
39.5k545107
39.5k545107
-bash-4.2$ find dist -type d -exec chmod a+x + find: 'dist/assets': Permission denied
â Frennetix
Mar 16 at 10:36
@Frenentix please change the trailing+
to;
. I'll update my question too
â roaima
Mar 16 at 10:40
add a comment |Â
-bash-4.2$ find dist -type d -exec chmod a+x + find: 'dist/assets': Permission denied
â Frennetix
Mar 16 at 10:36
@Frenentix please change the trailing+
to;
. I'll update my question too
â roaima
Mar 16 at 10:40
-bash-4.2$ find dist -type d -exec chmod a+x + find: 'dist/assets': Permission denied
â Frennetix
Mar 16 at 10:36
-bash-4.2$ find dist -type d -exec chmod a+x + find: 'dist/assets': Permission denied
â Frennetix
Mar 16 at 10:36
@Frenentix please change the trailing
+
to ;
. I'll update my question tooâ roaima
Mar 16 at 10:40
@Frenentix please change the trailing
+
to ;
. I'll update my question tooâ roaima
Mar 16 at 10:40
add a comment |Â
up vote
0
down vote
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.
1
You are correct, any decent modern tar implementation implements automated delayed directory setup for permissions and time stamps. When a directory is newly created during extraction, this is done with sane permissions and the permissions from the archive are applied later.
â schily
May 31 at 9:58
add a comment |Â
up vote
0
down vote
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.
1
You are correct, any decent modern tar implementation implements automated delayed directory setup for permissions and time stamps. When a directory is newly created during extraction, this is done with sane permissions and the permissions from the archive are applied later.
â schily
May 31 at 9:58
add a comment |Â
up vote
0
down vote
up vote
0
down vote
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.
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.
edited May 31 at 10:05
answered Mar 16 at 11:44
Stéphane Chazelas
280k53515847
280k53515847
1
You are correct, any decent modern tar implementation implements automated delayed directory setup for permissions and time stamps. When a directory is newly created during extraction, this is done with sane permissions and the permissions from the archive are applied later.
â schily
May 31 at 9:58
add a comment |Â
1
You are correct, any decent modern tar implementation implements automated delayed directory setup for permissions and time stamps. When a directory is newly created during extraction, this is done with sane permissions and the permissions from the archive are applied later.
â schily
May 31 at 9:58
1
1
You are correct, any decent modern tar implementation implements automated delayed directory setup for permissions and time stamps. When a directory is newly created during extraction, this is done with sane permissions and the permissions from the archive are applied later.
â schily
May 31 at 9:58
You are correct, any decent modern tar implementation implements automated delayed directory setup for permissions and time stamps. When a directory is newly created during extraction, this is done with sane permissions and the permissions from the archive are applied later.
â schily
May 31 at 9:58
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f430228%2ftar-command-create-directory-without-777-permission%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
4
you never, ever, ever need to have 777 rights.
â Carpette
Mar 14 at 17:22
@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.
â Frennetix
Mar 14 at 17:28
tar
does have ap
flag to preserve permissions however poor they may beâ thrig
Mar 14 at 17:34
1
@Carpette never say never. I can think of several scenarios where 777 is an appropriate permission mode.
â roaima
Mar 14 at 19:24
1
@RonJohn during the tar it create the subfolder but they haven't the right chmod so the subfolder and subfiles aren't created.
â Frennetix
Mar 15 at 16:33