AppendixFile Permissions and Access Rights
In Lesson 20, “File I/O and OS Operations,” we covered the use of files. A part of that use involved setting file permissions. In this appendix, we provide additional information about file permissions and access rights.
In general, each file has associated permissions that define how a user can interact with the file. In a Unix-like OS such as Linux, for example, there are three different access rights for files:
- Read Allows the user to read the file without making any changes.
- Write Allows the user to make changes to the file, including deleting the file itself. To have write privileges on a file, the user must have write privileges on the parent directory as well.
- Execute Allows the user to execute binary files and shell commands.
The access rights for each file are defined for three categories of users:
- The Owner of the File This is typically the user who created the file, although ownership can be transferred between users. The owner is represented by the letter u (for user).
- The Group to which the User Belongs In Linux, you can create a group of users who should all have the same access rights. For example, you can define a group for administrators who need to be able to execute commands and another group for users who only need to be able to view files on the server. Groups are represented by the letter g (for group).
- All Other Users Other users are represented by the letter o (for other).
In Linux, you can display the access ...
Get Job Ready Go now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.