Linux File Permissions and chmod Numbers Explained

How read, write and execute permissions work for owner, group and others, what numbers like 755 and 644 mean, and which settings to avoid.

By Utkarsh Garg · 2026-10-27 · 5 min read

Reading the permission string

Running ls -l shows a string such as -rwxr-xr-- at the start of each line. The first character is the type: a dash for a file and d for a directory. The next nine characters are three groups of three, for the owner, the group and everyone else. In each group the letters r, w and x mean read, write and execute, and a dash means that permission is missing.

How the numbers work

Each permission has a value: read is 4, write is 2 and execute is 1. You add the values for each group to get one digit, and the three digits together form the chmod number.

  • 7 is 4 + 2 + 1, which is read, write and execute.
  • 6 is 4 + 2, which is read and write.
  • 5 is 4 + 1, which is read and execute.
  • 4 is read only.
  • 0 is no access.

So 755 means the owner can read, write and execute, while the group and everyone else can read and execute. 644 means the owner can read and write, and everyone else can only read.

Settings you will use most

A few combinations cover most real situations.

  • 644 for ordinary files such as web pages and documents.
  • 755 for directories and for programs or scripts that others must run.
  • 600 for private files such as SSH private keys, which SSH refuses to use if others can read them.
  • 700 for private directories, such as the .ssh folder.

What the bits mean for directories

On a directory the meanings shift. Read lets you list the names inside, write lets you create or delete entries, and execute lets you enter the directory and reach the files inside it. This is why directories usually need the execute bit, and why a directory with read but no execute behaves in confusing ways.

Avoid 777

The setting 777 lets every user on the system read, change and run the file. It is a common quick fix when something fails with a permission error, but it removes all protection and is a real security risk on shared or public servers. Find out which user actually needs access and grant only that, for example by changing the owner or group with chown and chgrp.

Be careful with the recursive option. chmod -R 644 on a folder also removes the execute bit from directories and makes them unusable. Set files and directories separately.

Special bits and the default mask

A fourth leading digit can set special bits: 4 for setuid, 2 for setgid and 1 for the sticky bit. Setuid and setgid make a program run with the owner or group identity, and the sticky bit on a shared directory such as /tmp stops users deleting each other's files.

New files do not start at 777 or 666. The umask subtracts permissions from those defaults. A common umask of 022 gives new files 644 and new directories 755.

Worked example: reading and fixing a real listing

Suppose ls -l shows these three lines.

  • -rw-r--r-- 1 asha dev 2048 notes.txt
  • -rwx------ 1 asha dev 512 backup.sh
  • drw-r--r-- 2 asha dev 4096 reports

The first line is a file where the owner asha can read and write and everyone else can only read. That is 644. The second is a script only asha can use, which is 700. The third is a directory with 644, which is a mistake. Nobody, including the owner, has the execute bit, so nobody can enter it. Run chmod 755 reports and the owner can work in it again while others can list and enter it. The same fix in symbolic form is chmod u+x,go+x reports.

Symbolic mode and the umask at a glance

Symbolic examples and the umask results
Command or valueEffect
chmod u+x script.shAdds execute for the owner only
chmod go-w file.txtRemoves write from the group and others
chmod a+r file.txtAdds read for owner, group and others
chmod u=rw,go=r file.txtSets exactly 644
umask 022New files 644, new directories 755
umask 002New files 664, new directories 775, useful for shared group work
umask 077New files 600, new directories 700, private to the owner

In symbolic mode u is the owner, g the group, o others and a all three. A plus adds, a minus removes and an equals sign sets exactly. Symbolic mode changes only what you name, so it is safer than a number when you want to leave other bits alone.

Common permission errors and what they mean

  • Permission denied when running ./script.sh: the file lacks the execute bit. Run chmod u+x script.sh.
  • Permission denied when opening a file in a directory you can see: check the execute bit on every directory in the path, not only the file.
  • WARNING: UNPROTECTED PRIVATE KEY FILE from ssh: the key is readable by others. Run chmod 600 on the key and chmod 700 on the .ssh directory.
  • A web server returns 403 Forbidden: the server user cannot read the file or cannot enter a parent directory. Check both, and check who owns the files.
  • Operation not permitted from chmod: only the owner or root can change permissions. Use ls -l to see the owner, and sudo if appropriate.
  • A script works for you but not in cron: the cron job may run as a different user, so the owner bits do not apply to it.

Frequently asked questions

  • What does chmod 755 mean? The owner can read, write and execute. The group and everyone else can read and execute. It is the usual setting for directories and scripts.
  • How do I make a file executable? Run chmod +x filename, or chmod u+x to limit it to the owner.
  • What is the difference between chmod and chown? chmod changes what the owner, group and others may do. chown changes who the owner and group are.
  • How do I change permissions for all files in a folder? Use chmod -R, but set files and directories separately, for example with find . -type f -exec chmod 644 {} + and find . -type d -exec chmod 755 {} +.
  • Why does 644 on a directory break it? A directory needs the execute bit to be entered. Without it the contents cannot be reached even if they can be listed.