I have read permission a a file.
Which permissions and why are required _in the /
and in the /path
directories to be able to cat /path/file.txt
?
I have read permission a a file.
Which permissions and why are required _in the /
and in the /path
directories to be able to cat /path/file.txt
?
In order to access to any file located under the /path directory, the user must have the x (execute) permission granted for each of the directories in the path (this including root).
The reason for this is that cat will use the open system call. System call which : can fail with the following errors:
EACCES (…) or search permission is denied for one of the directories in the path prefix of pathname, (…)
Note that this page invites you to learn more about path resolution in Linux.
I can summarize what I learned from suggested question
For what I understand
To read a file content i do not need the 'r' permission on directory because I know the filename so I do not need to read the directory listing
To read a file content i stille need the 'x' permission on directory because it's required to resolve the path to the file contents
What causes confusion in me the difference from file names and file contents. The first is in the directory the second is in the files. But to access a file i need 'x' because i need to access the directory itself anyway.