devkult_
tools29converters34
home/chmod/2775

chmod 2775

rwxrwsr-xUse with care

775 plus setgid: new files inherit the directory's group.

2775 is 775 with the setgid bit set on a directory. Files and subdirectories created inside it inherit the directory's group instead of the creator's primary group, and new subdirectories inherit the setgid bit too. In ls -l the group's x becomes an s: rwxrwsr-x.

It's what makes a shared team folder keep working — without it, each new file ends up in its creator's personal group and teammates can't edit it.

Permission by permission

WhoReadWriteExecuteDigitMeans
owner✓✓✓7read, write and execute
group✓✓✓7read, write and execute
others✓—✓5read and execute
  • In ls -l: -rwxrwsr-x for a file, drwxrwsr-x for a directory.
  • Symbolic form: u=rwx,g=rwx,o=rx,g+s
  • New directories get this mode when the umask is 002.

Use it for

  • Shared project directories for a group of users.
  • Web directories written by both a deploy user and the web server's group.

Avoid it for

  • Directories where others shouldn't read anything: use 2770.
  • Remember users' umask still applies: set it to 002 so new files are group-writable.

Commands

chmod 2775 path

set this mode on a file or directory

chmod u=rwx,g=rwx,o=rx,g+s path

the same, written symbolically

find path -type d -exec chmod 2775 {} +

apply it to every directory in a tree, leaving the files alone

stat -c '%a %A %n' path

check the current mode on Linux (macOS: stat -f '%Lp %Sp %N' path)

Try variations

2775
-rwxrwsr-x
WhoreadwriteexecuteDigit
owner7
group7
others5

The owner can read, write and execute; the group can read, write and execute; everyone else can read and execute. Special: runs as, or passes on, the file's group (setgid).

chmod 2775 file
chmod u=rwx,g=rwx,o=rx,g+s file

Read the full guide to chmod 2775 →

Frequently asked questions

How do I set up a shared folder on Linux?

Create a group, add the users, then chgrp -R team /srv/shared and chmod 2775 /srv/shared. Make sure the users' umask is 002 so their files are group-writable.

Related modes