Linux File Permissions Explained: What chmod 755 and 644 Mean

Understand rwx permissions, octal numbers like 755 and 644, setuid, setgid and the sticky bit, and how to pick safe chmod values for files and folders.

Updated September 29, 2026 7 min read

Use the free Chmod CalculatorConvert Unix permissions between checkboxes, octal 755 and rwxr-xr-x

A deploy script fails with "Permission denied". A web server returns 403 for a folder you just uploaded. A hosting guide tells you to "chmod the directory to 755 and files to 644", and you would like to know what that actually does before you run it on a server.

Unix permissions look cryptic, but they follow a small, consistent system. This guide explains what the letters and numbers mean, how to translate between them, which values fit common situations, and where the special bits come in.

Who, and what they can do

Every file and directory on Linux, macOS and other Unix-like systems has an owner, a group, and a permission mode. The mode answers three questions for three classes of people:

  • Owner (u): the user who owns the file.
  • Group (g): members of the file's group.
  • Others (o): everyone else on the system.

For each class there are three permissions:

Permission On a file On a directory
Read (r) View the contents List the names inside
Write (w) Change the contents Create, delete or rename entries inside
Execute (x) Run it as a program Enter it and reach files inside (cd, open by path)

The directory column trips people up. A folder with read but no execute lets you see file names but not open them. A folder with execute but no read lets you open a file only if you already know its name. Web servers need execute on every directory in the path to reach a file.

Reading ls -l output

Run ls -l and you will see a string like -rwxr-xr-x. The first character is the type (- for a regular file, d for a directory, l for a symbolic link). The next nine characters are three groups of three:

- rwx r-x r-x
  |   |   └── others: read, execute
  |   └────── group:  read, execute
  └────────── owner:  read, write, execute

A dash means the permission is off.

From letters to octal numbers

Each permission has a value: read = 4, write = 2, execute = 1. Add them up per class and you get one digit from 0 to 7:

Digit Letters Meaning
7 rwx read + write + execute
6 rw- read + write
5 r-x read + execute
4 r-- read only
0 --- nothing

Write the three digits in the order owner, group, others. So rwxr-xr-x is 7-5-5, or 755, and rw-r--r-- is 6-4-4, or 644. This is octal (base 8) notation, which is why only the digits 0 to 7 appear. If you want to see the binary behind each digit, a number base converter makes the three bits visible.

Values you will use most

  • 644 for ordinary files such as HTML, images and config: the owner edits, everyone else reads.
  • 755 for directories and scripts that need to be executed: everyone can enter or run, only the owner changes.
  • 600 for private files like SSH private keys or .env files. SSH refuses to use a private key that others can read.
  • 700 for private directories such as ~/.ssh.
  • 664 and 775 for team folders where a shared group must also write.
  • 777 gives everyone full control. It is almost never the right fix and is a common way web servers get compromised.

The special bits: setuid, setgid and sticky

A fourth, leading octal digit holds three extra flags:

  • setuid (4000): an executable runs with the file owner's privileges rather than the caller's. The system passwd command uses this so users can update a root-owned file.
  • setgid (2000): on an executable, it runs with the file's group. On a directory, new files inherit the directory's group, which keeps shared project folders tidy.
  • sticky (1000): on a directory, users can delete only their own files even if the directory is world-writable. /tmp is the classic example, with mode 1777.

In ls -l output these replace the x position: s for setuid/setgid, t for sticky. A capital S or T means the special bit is set but the underlying execute bit is not, which is usually a mistake.

Work out a mode with the calculator

The Chmod Calculator converts between checkboxes, octal and symbolic forms in both directions.

  1. Open the Chmod Calculator. It starts at 755.
  2. Tick or untick Read, Write and Execute for Owner (u), Group (g) and Others (o). The Octal digit row updates under each column.
  3. To go the other way, type a number such as 640 into Octal (numeric), or paste a string like rw-r----- into Symbolic (ls -l style). The checkboxes follow.
  4. Tick setuid, setgid or sticky if you need a special bit; the octal value becomes four digits.
  5. Enter a name in File or directory and tick Recursive (-R) if needed. Two ready-made commands appear, one numeric (chmod 755 deploy.sh) and one symbolic (chmod u=rwx,g=rx,o=rx deploy.sh). Copy whichever you prefer.
  6. The Common permissions buttons load 644, 755, 600, 700, 775, 664, 777 and 1777 with a short description of each.

If you allow others to write, the tool shows a warning, because that is rarely intended on a server.

Doing it from the command line

chmod accepts both notations. Numeric sets the whole mode at once:

chmod 644 index.html
chmod 700 ~/.ssh

Symbolic changes only what you mention, which is safer when you want to adjust one bit:

chmod u+x deploy.sh      # add execute for the owner
chmod go-w config.yml    # remove write for group and others
chmod g+s shared/        # set setgid on a directory

To check a file's current mode as a number on Linux, use stat -c '%a %n' filename. On macOS the equivalent is stat -f '%Lp %N' filename.

Pitfalls and troubleshooting

Don't use chmod -R 755 on everything

Recursive numeric modes apply the same value to files and folders. That makes every file executable, which is untidy and sometimes risky. The common pattern is to treat them separately with find:

find /var/www/site -type d -exec chmod 755 {} +
find /var/www/site -type f -exec chmod 644 {} +

Alternatively, the capital X in symbolic mode (chmod -R u=rwX,go=rX site/) adds execute only to directories and to files that already had it.

Permission denied even with the right mode

Check ownership (ls -l shows owner and group), since 644 means nothing useful if the web server runs as a different user who is not in the group. Check every parent directory for execute permission. On some systems, SELinux or AppArmor policies can deny access regardless of mode bits.

Windows and mounted drives

NTFS and FAT drives mounted in Linux or WSL may ignore chmod, because the file system has no Unix mode bits. Permissions there are controlled by mount options or Windows ACLs.

Web server config files

Files like .htaccess should be readable by the server but not writable by it. If you are editing redirect rules, the .htaccess redirect generator helps with the content; 644 is the usual mode. If a page still returns 403 after fixing modes, the guide to HTTP status codes lists the other usual causes, and server firewall rules written with the IP subnet calculator are worth checking too.

Frequently asked questions

What does chmod 755 mean?

The owner can read, write and execute, while the group and everyone else can read and execute but not change the file. It is the standard mode for directories and scripts.

What is the difference between 644 and 755?

The only difference is the execute bit. 644 suits normal files that are just read; 755 is for directories and programs that must be entered or run.

Is chmod 777 ever safe?

Rarely. It lets any user or process on the machine modify or replace the file. Fix ownership or group membership instead, and use 775 or 664 for shared team access.

What does a capital S in ls -l output mean?

It means setuid or setgid is set but the execute bit underneath is not. The special bit has no useful effect in that state, so it usually indicates a mistake.

Does chmod change who owns a file?

No. chmod changes the permission mode only. Use chown to change the owner and chgrp to change the group.

Try it now: Chmod Calculator

Loading tool…