Permission-Check Algorithms
Here is a quick overview of how permissions interact with the file operations discussed earlier:
You must have read permission to open a file for reading with O_RDONLY or O_RDWR.
You must have write permission to open a file for writing with O_WRONLY and O_RDWR.
You must have write permission to O_TRUNC a file.
You must have write and execute permission on a directory to create a new file. You need write permission so you can modify the directory entry, and you need execute permission so the directory can be searched.
You must have write and execute permission on a directory to delete a file. You do not actually need read/write permissions on the file itself because the operation just manipulates the directory’s ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access