Consider that ‘dq’ and ‘learn’ are two users and there is one file say ‘x’ and a executable program say ‘p’ in ‘learn’s’ home directory. ‘dq’ has r-x access to files in ‘learns’ home directory. If the program ‘p’ can modify the content in file ‘x’ and dq can execute this program, will ‘dq’ indirectly get the access to the file ‘x’ ? or the program execution will pop an error: file permission denied ?
Please provide a question link and a screenshot of your code and expected output as per these guidelines.
Edit: yes as @otavios.s has said, please share your code formatted in markdown so we can use it to easily troubleshoot your issue.
Actually my question is bit conceptual and hence I have not shared any code with it. It is out of curiosity, that I asked.
Your question is quite vague and unclear to me. Do you mind elaborating further?
So from what I understand from your scenario, this is what happens when I enter the following commands at the command line:
$pwd /home/learn $ls -l -rwxr-xr-x p.exe -rwxr-xr-- x.txt
You need to bear in mind that the permissions is linux are as follows
- rwx rwx rwx [directory] [owner] [group] [other user]
The first character is a hyphen
- if the object is a file (and not a folder) otherwise its a
d which stands for directory (or a folder).
And I am assuming
learn is the owner and
dq is a user in the group which is specified to have access to
If this is the case it depends. Say
x was a assembly or C file instead of a
dq would need to recompile
x.exe, which he does not have permission to do since he cannot write to the file (only read and execute).
Thank you for your response @masterryan.prof : I am sorry that my initial question seems bit unclear. I will try my best to elaborate. You interpreted most of the part correctly but I guess you are having a bit of trouble understanding about files I stated. Consider that there is a program
p which reads the file
x.txt and makes changes in it. Owner of this files is
dq is another user which has permission
r-- for file
rwx for program
dq can access and execute the program
p will that give
dq a chance to access
p even though he does not have access to
x.txt or will the execution of program
p result in error.
(Note- This is just out of my curiosity resulted from learning something new and is not about anything in instruction section that we need to implement on screens.)
Hi @dvbagul: I have not come across such a situation in the command line but logically, it is possible since it is possible for
p to indirectly modify
x.txt without having any error and I guess this is true in the case of log files (i.e. the system administrator does not want the user to tamper with the log files generated by the application
Hope this clarifies!
Oh okay got it, Thank you again @masterryan.prof for clarifying. Now I am all clear!
No worries @dvbagul anytime!