chmod 775 (rwxrwxr-x)
Answer
chmod 775 sets rwxrwxr-x: the owner and the group can read, write and execute (on a directory: list, enter, and create or delete entries), and everyone else can read and execute only.
chmod 775 = rwxrwxr-x: owner full access, group full access, others read and execute.
| Read 4 | Write 2 | Execute 1 | Digit | |
|---|---|---|---|---|
| Owner (user) | 7 | |||
| Group | 7 | |||
| Others | 5 | |||
| Special | 0 |
7Owner (user): 7 = 4 read + 2 write + 1 execute7Group: 7 = 4 read + 2 write + 1 execute5Others: 5 = 4 read + 1 execute
On a file
- Owner (user) read it, change it and run it as a program
- Group read it, change it and run it as a program
- Others read it and run it as a program
On a directory
- Owner (user) list the names inside, enter it and open files by name, create and rename and delete entries
- Group list the names inside, enter it and open files by name, create and rename and delete entries
- Others list the names inside and enter it and open files by name
chmod 775 filechmod u=rwx,g=rwx,o=rx filels -l → -rwxrwxr-x
What to know
775 is the shared-group version of 755. It is what new directories get under umask 002.
For a directory several people write to, 775 alone is not enough: each new file gets its creator's primary group, so others in the team may be unable to edit it. Adding the setgid bit (2775) makes new entries inherit the directory's group.
Where it fits
- Shared project or release directories owned by a team group
- Upload or cache directories written by a web server through its group, while others only read
- Scripts that a group of maintainers may edit and anyone may run
Gotchas
- Group members can delete or rename any file in a 775 directory, including files they did not create. Add the sticky bit (3775) if that matters.
- Others can still list and read everything. For team-only directories use 770, or 750 if the group only needs to read.
Related explainers
- chmod 2775: setgid directory (rwxrwsr-x)chmod 2775 makes a directory shared: files created in it inherit its group. How to set up a team directory...
- chmod 664 (rw-rw-r--)chmod 664 lets the owner and the file's group edit a file while others can only read it. Used for files in...
- chmod 755 (rwxr-xr-x)chmod 755 gives the owner read, write and execute, and everyone else read and execute. When to use it for...
- umask 002umask 002 creates files as 664 and directories as 775, so your group can edit what you create. When to use...
- chmod 777 (rwxrwxrwx)chmod 777 lets every user on the system read, change and run a file. Why it is almost always the wrong fix...