File Permissions
From the very start, Unix was designed as a multiuser environment in which different users are given different permissions. But more than that, users can be assigned to groups too, and files and programs can then be made accessible either by user or by group. All this rich multiuser support and precision control over the filesystem has been brought into Linux, making it one of the most robust and secure computing environments. It’s achieved by combining all the different concepts of users, groups, and file permissions.
Taking file permissions first, all files have a set of attributes that define what can and can’t be done with a file, and who has permission to access it. These are known as permissions, of which there are three main types:
- Read
A file with only this permission set can be read but cannot be written to or executed.
- Write
A file with this permission set can be written to.
- Execute
A file with this permission set can be executed. In other words, this permission is applied to applications.
These permissions can be combined with each other to provide the eight possibilities in Table 5-2. The permissions are numbered from 0 through 7 because these are the numbers that you will use when manually changing a file’s permissions using the command line (see Chapter 7).
Table 5-2. Combinations of file permissions
Number | Meaning |
|---|---|
0 | No permissions |
1 | Execute only |
2 | Write only |
3 | Execute and write |
4 | Read only |
5 | Execute and read |
6 | Write and read |
7 | Execute and write and read |