Each file and folder has three sets of permissions: Owner, group, and other or world. Owner permissions are given to the user that owns the file. Group permissions are given to anyone who’s a member of the group that owns the file. By default, files are owned by a group with the same name as the user that made the file.
There’s three permissions: read, write (edit or delete the file), and execute (run the file if it’s a program), represented by 4, 2, and 1.
| User | Group | Other | |
|---|---|---|---|
| Read (r) | 4 | 4 | 4 |
| Write (w) | 2 | 2 | 2 |
| Execute (x) | 1 | 1 | 1 |
| Total permissions |
The sum of these numbers for each column makes up the “mode” or permissions set on the file. For example, running chmod 744 file.txt would give the owner of that file read+write+execute, the group read, and the owner read permissions.
The root account (UID 0) has full permissions to do almost anything on the system.
Users are stored in /etc/passwd. Groups are stored in /etc/group. User passwords are stored in /etc/shadow.