Chmod Calculator
← SkillSafe

Chmod calculator: work out any file permission

Type a number like 755, letters like rwxr-xr-x, or paste an ls -l line. See what it allows, what is risky, and the chmod command to copy.

Try one:

Saved ls -la output to a file? or drop it on the box.

Common chmod numbers

NumberLettersUse it for

How it works

  1. Type or paste. A number (755, 0644, 4755), nine letters (rwxr-xr-x), an ls -l line or a whole ls -la listing, stat output, or a chmod command like chmod u+x run.sh or chmod go-w file. Letters like u+x are applied to a starting mode, 644 for a file and 755 for a folder, which you can change under More options.
  2. Read it in every form. The number, the letters, the ls -l string and the chmod letters, plus what the owner, the group and everyone else can do. On a folder, read lists the names, write adds and deletes, execute lets you in.
  3. Tick to change it. The boxes for read, write and execute and the special bits update everything at once.
  4. Look at the check. 777, anything everyone can write, a private key or ~/.ssh others can read, setuid, and folders that can be listed but not entered are named, with the fix.
  5. Copy the command. chmod with the number or the letters, the find commands that set folders and files separately, chown, and a check. Download them as a bash script or as a Markdown summary.

Questions

What does chmod 755 mean?
755 is rwxr-xr-x. The owner can read, change and run the file (7 = 4 read + 2 write + 1 execute); the group and everyone else can read and run it but not change it (5 = 4 + 1). It is the usual mode for programs, scripts and folders.
What does chmod 644 mean?
644 is rw-r--r--. The owner can read and change the file; everyone else can only read it. It is the usual mode for ordinary files such as web pages, images and config that is not secret.
Why not just use chmod 777?
777 lets every account on the machine change the file, or add, delete and replace anything in the folder. A web server or a teammate that needs to write should get it through ownership or a shared group instead, for example chown and 775 or 2775.
How do I set folders to 755 and files to 644 in one go?
Use find: find DIR -type d -exec chmod 755 {} + and find DIR -type f -exec chmod 644 {} +. chmod -R 755 would make every file executable too. chmod -R u=rwX,g=rX,o=rX DIR does both in one command: capital X gives execute to folders only.
What permissions does an SSH private key need?
600 (rw-------) or 400. SSH refuses a private key that the group or others can read, with the warning UNPROTECTED PRIVATE KEY FILE. The ~/.ssh folder should be 700 and authorized_keys 600.
What are setuid, setgid and the sticky bit?
The fourth, leading digit. setuid (4) runs a program with its owner's rights; setgid (2) does the same with its group, and on a folder makes new files take the folder's group; sticky (1) on a folder lets people delete only their own files, as in /tmp (1777).
What does umask do?
It takes permissions away from new files and folders. New files start from 666 and folders from 777, minus the umask: with the common 022 you get 644 files and 755 folders; with 002, 664 and 775.
Is anything uploaded?
No. The calculator, the check and the commands are worked out inside your browser tab. Only the optional AI step sends what you type into it, and only when you press its button.