chmod 440 r--r-----

chmod 440 (r--r-----): the owner can read, the group read, others do nothing. Typical use: read-only config such as sudoers. Commands and umask.

Octal
440 (also written 0440)
Symbolic
r--r-----
ls -l shows
-r--r----- for a file, dr--r----- for a directory
chmod letters
u=r,g=r,o=

Who can do what

ClassDigitBitsOn a fileOn a directory
Owner (u)4r--Read the contentsList the names inside and see names only, not open or inspect the files
Group (g)4r--Read the contentsList the names inside and see names only, not open or inspect the files
Others (o)0---NothingNothing

Each digit adds read (4), write (2) and execute (1). Deleting or renaming a file depends on write and execute on the directory that holds it, not on the file's own mode. Root bypasses read and write checks.

Typical uses

The owner and the group can read, nobody can write. /etc/sudoers ships as 0440 on most Linux distributions, and visudo keeps it that way. It also suits a config file holding secrets that a service reads through its group, and WordPress suggests 440 or 400 for wp-config.php.

Security notes

  • Only the owner (and root) can change it; the group and others are limited to the read and execute rights shown above, which is the usual safe pattern for shared files and directories.

Commands

  • Numeric
    chmod 440 file
  • Symbolic
    chmod u=r,g=r,o= file
  • Check the result
    stat -c '%a %A %n' file
  • Files only, recursively
    find /path -type f -exec chmod 440 {} +

The umask that gives 440

No umask produces 440: a umask only removes bits from 666 for files and 777 for directories, and it never sets execute on a new file. Set it with chmod after creating the file or directory.

Its directory counterpart is chmod 550 (r-xr-x---).

Other common modes

Work out any other mode in the chmod calculator