chmod 750 (rwxr-x---)

The owner has full access, the group can read and enter or run, and everyone outside the group is shut out. Think of it as 755 with the public removed.

Owner
Group
Others
Symbolic
Command

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

What chmod 750 sets

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

ls -l shows this mode as -rwxr-x--- on a file and drwxr-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.

The pattern: root owns it, the service reads it through a group

750 is at its best on a directory that one service has to read and nobody else should see, such as configuration containing credentials:

chown -R root:myapp /etc/myapp           # as root
chmod 750 /etc/myapp
chmod 640 /etc/myapp/*.conf

The service, running as a user in group myapp, can enter the directory and read its configuration. It cannot change it, so a compromised service cannot rewrite its own settings. Every other account is stopped at the directory. Compare the alternatives: 755 lets every local user in, and 700 would force you to make the service the owner, which gives it write access too.

The same shape suits administrative scripts that only an operations group may run, and a home directory that should be closed to other users but readable by a backup or web service placed in its group.

Check the group, because that is who gets in

ls -ld /etc/myapp                        # owner and group of the directory itself
stat -c '%a %U:%G %n' /etc/myapp         # GNU/Linux
id myapp                                 # groups the service account is in
  • If the directory's group is your own personal group, 750 is 700 in practice.
  • Every member of the group can read everything the files inside allow. Choose a narrow group, not a catch-all such as users.
  • Group changes apply to new login sessions and newly started services, not to processes that are already running.
  • The group also needs execute permission on every directory above this one.

Files inside should be 640

chmod -R 750 marks every file as executable. Give directories and files their own modes:

find /srv/app -type d -exec chmod 750 {} +
find /srv/app -type f -exec chmod 640 {} +
chmod -R u=rwX,g=rX,o= /srv/app          # or in one pass

The capital X gives execute to directories and to files that are already executable, and to nothing else. To have new files and directories created this way from the start, run the process with umask 027: directories come out as 750 and files as 640.

750 compared with its neighbours

ModeSymbolicDifference from 750
755rwxr-xr-xOthers can read and enter too
700rwx------The group is shut out as well
770rwxrwx---The group can also create, change and delete
711rwx--x--xEveryone may pass through, nobody but the owner may list

Questions

What is the difference between chmod 750 and 755?

The last digit. With 755 every user on the system can read and enter the directory or run the file. With 750, users who are neither the owner nor in the group get nothing at all. Use 750 when the contents are not for everyone on the machine.

What umask gives 750?

A umask of 027. It removes write for the group and everything for others, so new directories are created as 750 and new files as 640.

Why does a group member still get "Permission denied" on a 750 directory?

Usually one of four things: the directory belongs to a different group from the one you expect (check with ls -ld); the user was added to the group after logging in and needs a new session; a parent directory does not give them execute permission; or the file they want inside has no group read bit.