chmod 750
The owner can do everything, the group can read and execute, and everyone else is shut out. For directories and programs meant for one group.
| Read (4) | Write (2) | Execute (1) | Digit | |
|---|---|---|---|---|
| Owner | 7 | |||
| Group | 5 | |||
| Others | 0 |
A program runs with the rights of the file's owner.
A program runs with the file's group. In a directory, new files get the directory's group.
In a directory, users can't delete or rename each other's files.
Owner can read, write and execute. Group can read and execute. Others have no access.
chmod 750 filechmod u=rwx,g=rx,o= fileCommon values
What 750 allows
| Who | Digit | On a file | On a directory |
|---|---|---|---|
| Owner | 7 rwx | read, change and run | list, enter, add and remove files |
| Group | 5 r-x | read and run | list and enter |
| Others | 0 --- | nothing | nothing |
ls -l shows this mode as -rwxr-x--- on a file and as drwxr-x--- on a directory.
The owner has full control, members of the group can read and enter or execute, and everyone else is kept out completely.
Where it belongs
- A directory for one group. Project files or logs that colleagues in the same group may look at and the rest of the machine may not.
- Programs for a few. An administration script that the operators in a group may run, without other users being able to read how it works.
- Application directories on a server. The owner is the account that installs the code, the group is the one the service runs under. The service can read everything and can't change its own code.
Next to 755, 700 and 770
Compared with 755 only the last digit differs: 0 instead of 5 closes the door to everyone outside the group. Compared with 700 the group is let in to read.
The group gets no write permission. If its members have to create or change files, the mode to use is 770.
The chmod calculator explains how the digits are built, and what setuid, setgid and the sticky bit add to them.