chmod 775 (rwxrwxr-x)

Owner and group have full access; everyone else can read and enter or run, but not change anything. On a directory, every member of the group can add, rename and delete files.

Owner
Group
Others
Symbolic
Command

This tool runs in your browser. We never send what you type or paste to a server.

What chmod 775 sets

WhoDigitReadWriteExecuteSymbolic
Owner (u)7yesyesyesrwx
Group (g)7yesyesyesrwx
Others (o)5yesnoyesr-x
chmod 775 file          # numeric
chmod ug=rwx,o=rx file  # the same, in symbolic form

ls -l shows this mode as -rwxrwxr-x on a file and drwxrwxr-x on a directory. On a file, execute means it can be run as a program. On a directory, read lists the names inside, write creates, renames and deletes entries, and execute (search) is what lets you enter it and reach the files inside.

On a directory, group members can delete each other's files

Write permission on a directory is permission to change its list of entries: create, rename and delete. It applies to every entry, whoever owns it and whatever its mode. In a 775 directory a group member can delete your 644 file, or replace it with one of their own, even though they could not edit it in place.

For a team directory that is normally the intention. If it is not, add the sticky bit, which limits deleting and renaming to the owner of each file and the owner of the directory:

chmod +t shared          # 775 becomes 1775, shown as drwxrwxr-t

The alternative to 777 when a service must write

The common case: a web application has to save uploads or cache files and gets "Permission denied". The directory does not need to be opened to everyone. It needs to be writable by one more account, the one the server runs as, and a group does that:

ps -o user= -C nginx | sort -u     # Linux (procps): the user the server runs as
chgrp www-data uploads             # that user's group; www-data is the Debian and Ubuntu name
chmod 775 uploads

Do this only on the directories that have to be written to. Leave the code at 755 and 644, owned by an account the server does not run as, so that a flaw in the application cannot rewrite the application.

Where 775 comes from by default

With a umask of 002, new directories are created as 775 and new files as 664. On distributions that give each user a private group, your directories may already show drwxrwxr-x while being shared with nobody: the group is you alone.

Sharing starts when the directory is given to a group with other members. New files then need the same group, which 775 does not arrange: they take their creator's primary group unless the directory has the setgid bit, as in 2775.

775 on a file

A program that every group member may modify and anyone may run. Whoever can write to a program decides what happens to the next person who runs it, and if that is root or a cron job, a group member has gained their privileges. For executables, prefer 755 with a single owner.

Applied recursively, 775 makes every file executable. Set the two kinds separately:

find shared -type d -exec chmod 775 {} +
find shared -type f -exec chmod 664 {} +

775 compared with its neighbours

ModeSymbolicDifference from 775
755rwxr-xr-xThe group cannot write: one owner makes all the changes
2775rwxrwsr-xAdds setgid: new files inherit the directory's group
770rwxrwx---Others get nothing: shared inside the group, closed outside
777rwxrwxrwxEveryone can write: no longer access control

Questions

What is the difference between chmod 775 and 755?

The group write bit. With 755 only the owner can change a file or add and remove entries in a directory. With 775 every member of the group can too. Others are treated the same by both: they can read and enter or run, and cannot change anything.

Is chmod 775 safe for a website directory?

It is as safe as the group is small. Use it on the directories the web server has to write to, such as uploads or a cache, with the group set to the one the server runs under, and configure the server not to execute scripts from those directories. Code directories should stay 755 with files at 644.

Why are new files in my 775 directory not writable by the group?

A directory's mode is not passed on to the files created in it. Each new file gets its mode from the umask of the process that creates it, and with the common umask of 022 that is 644. Have the group's members use umask 002, and set the setgid bit on the directory (chmod g+s) so that new files also get the right group.