Tar exploded permissions are difefrent

Downloaded open JDK tar.gz file from . When I expand this file with command tar -xf openjdk-15.0.2_linux-x64_bin.tar.gz on one box permissions look like

drwxr-xr-x 2 me me 4.0K Feb 17 15:57 bin

On the other hand when same file, copied to other box and expanded with same command

drwxr-x--- 2 me me 4.0K Feb 17 16:37 bin

Same applies to other files in bin directory - no one except myself who expanded the file has execute permissions. As a result I am not able to execute any of the java commands as a different user.

Both machines are Ubuntu 20.04. What could be causing the difference?

4

1 Answer

As noted in man tar, when you extract an archive using tar as an unprivileged user, the default behavior is to apply the invoking user's umask to the extracted file permissions:

 --no-same-permissions Apply the user's umask when extracting permissions from the ar‐ chive (default for ordinary users).

In particular, a umask of 0027 removes all permissions for others, whereas 0022 removes only write permissions.

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

You Might Also Like