I am curious, in the following scenario, what kind of permission does a shell script or Java program has (owner/group/other)?
There is a script called
run.sh, and it in turn calls a Java program
a.java. The script and the java is owned by user A and have
-rwxrw-r-- permissions. When they were run by user A, which permission group do they belong to? Do they get the permission from user A as a owner?
And there is another user B, who is in the same group with user A. He execute
run.sh and in turn calls the Java program. Now what permission group do they belong to? Do they get the permission from user B as a group?
Maybe the program will try to write on a directory
/common/abc which have a permission of
drwxrw-r--, if the program have a permission of "other", it will fail.
A point to notice, is that they both use the expression
sh run.sh to run the script, so they don't need the execute permission. Does it only require the read permission?