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 binOn 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 binSame 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?
41 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.