breakitdown

chmod 755 (rwxr-xr-x)

Answer

chmod 755 sets rwxr-xr-x: the owner can read, write and execute; the group and everyone else can read and execute but not change anything. It is the standard mode for directories and for programs and scripts that other users need to run.

Try

chmod 755 = rwxr-xr-x: owner full access, everyone else read and execute.

Read 4Write 2Execute 1Digit
Owner (user)7
Group5
Others5
Special0
  1. 7
    Owner (user): 7 = 4 read + 2 write + 1 execute
  2. 5
    Group: 5 = 4 read + 1 execute
  3. 5
    Others: 5 = 4 read + 1 execute

On a file

  • Owner (user) read it, change it and run it as a program
  • Group read 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 and enter it and open files by name
  • Others list the names inside and enter it and open files by name

chmod 755 filechmod u=rwx,go=rx filels -l → -rwxr-xr-x

What to know

The three digits are owner, group and others. 7 is read (4) + write (2) + execute (1); 5 is read (4) + execute (1). So only the owner can modify the file or directory, and nobody else can.

On a directory, the 5 for group and others means they can list it and reach the files inside, but cannot create, rename or delete entries. That is why web server document roots and most system directories are 755: the server process can walk into them, but only the owner can change what is there.

755 is also what a new directory gets when your umask is the common 022. See umask 022.

Where it fits

Gotchas

Related explainers

← chmod calculator