HomeText & Developer Tools › Chmod Calculator

Chmod Calculator

Tick read, write and execute for owner, group and others to get the numeric chmod mode and its symbolic form - or type a number and see which permissions it grants.

   
   
   
   

Reading a Unix permission mode

Every file on a Unix-like system - Linux, macOS, BSD, and anything you reach over SSH or SFTP - carries nine permission bits arranged as three groups of three. The groups are the file's owner, the file's group, and everyone else. Within each group the bits are read (r), write (w) and execute (x). Each bit has a value: read is 4, write is 2, execute is 1. Add them up and you get one octal digit per group, which is why permissions are written as three digits.

So 7 = 4+2+1 = read, write and execute; 6 = 4+2 = read and write; 5 = 4+1 = read and execute; 4 = read only; 0 = nothing. A mode of 755 means the owner can do everything (7), while the group and everyone else can read and execute but not write (5 and 5). Its symbolic form is rwxr-xr-x, which is what you see in the first column of ls -l, after a leading character showing the file type: - for a regular file, d for a directory, l for a symbolic link.

What the bits mean on a directory

The same three bits mean something different on a directory, and this is the part that trips people up. Read on a directory means you can list its contents. Write means you can create, rename and delete entries inside it - note that deleting a file depends on the directory's permissions, not the file's, which is why you can remove a read-only file from a directory you own. Execute means you can traverse into it and access a file inside by name.

That is why directories normally get 755 and plain files get 644: without the execute bit, a directory is unusable even if it is readable. A directory with 744 lets you run ls but not cd, and a directory with 711 lets you open a file whose exact name you know while hiding the listing - a pattern used for web-served upload folders. Copying a mode recursively with chmod -R 644 is the classic way to lock yourself out of your own tree; use find . -type d -exec chmod 755 {} + and find . -type f -exec chmod 644 {} + instead.

Special bits, umask and common modes

Above the nine bits sit three more, written as a fourth leading octal digit. setuid (4000) makes an executable run as its owner rather than as you - that is how passwd can edit the shadow file - and it appears as an s in the owner's execute position. setgid (2000) does the same for the group, and on a directory it makes new files inherit the directory's group, which is the standard way to share a project folder. The sticky bit (1000) on a world-writable directory restricts deletion to each file's owner; /tmp is mode 1777 for exactly this reason.

New files do not get 777 by default because of the umask, a mask of bits to remove. The usual umask is 022, so a file created with a requested 666 ends up 644 and a directory requested at 777 ends up 755. A umask of 077 makes everything private to you. Practical guidance: 600 for SSH private keys and .env files (OpenSSH refuses to use a key that others can read), 700 for ~/.ssh, 644 for web content, 755 for scripts and directories, and never 777 - if something only works at 777, the real problem is ownership, and chown is the fix.

Frequently asked questions

What does chmod 755 mean?

The owner can read, write and execute; the group and everyone else can read and execute but not write. In symbolic form that is rwxr-xr-x. It is the standard mode for directories, scripts and programs.

What is the difference between 644 and 755?

The execute bit. 644 (rw-r--r--) is right for documents, images and source files; 755 (rwxr-xr-x) adds execute, which scripts need to run and directories need to be entered at all.

Why is chmod 777 a bad idea?

It lets any account on the machine modify or replace the file, including a compromised web process. If a permission problem seems to need 777, the file is usually owned by the wrong user - fix it with chown instead.

Do these permissions work on Windows?

Not natively. Windows uses ACLs, so a file copied to NTFS loses its mode. Inside WSL, Git Bash or an SFTP client the octal mode still applies, and Git stores only whether a file is executable.