Linux file permissions
chmod 775: what it means and when to use it
chmod 775 gives the owner and the group full access, while everyone else can read and execute.
775
rwxrwxr-x
| Who | Digit | Read | Write | Execute |
|---|---|---|---|---|
| Owner | 7 |
Yes | Yes | Yes |
| Group | 7 |
Yes | Yes | Yes |
| Everyone else | 5 |
Yes | No | Yes |
How chmod 775 works
The two 7s give read, write and execute to the owner and to the group. The final 5 lets other users read and enter, but not change anything.
It suits directories shared by a team or by several services. Put the web server and your deploy user in the same group, set the folder to 775, and both can write to it without opening it to the whole machine.
Where 775 belongs
- Shared project directories
- Upload or cache folders written by a web server group
- Git repositories shared between several users
The command
Both of these set exactly the same permissions. The number is shorter; the letters are easier to read back later.
chmod 775 filename
chmod u=rwx,g=rwx,o=rx filename
775 only helps if the right users are in the group. Check the owner and group with ls and fix them with chgrp before reaching for anything wider.