About chmod calculator
Linux file permissions say who can read, write or execute a file. chmod changes them, and the numeric form is compact.
How the numbers work
- Read = 4, write = 2, execute = 1. Add them for each of owner, group and others.
- 755 = rwxr-xr-x (owner full, others read and run).
- 644 = rw-r--r-- (usual for files).
- 600 = rw------- (private, such as SSH keys).
Avoid 777
Giving everyone write access is a security risk. Use the least permission that works.
A worked example
To let the owner read, write and run a script but others only read and run it, set rwxr-xr-x, which is 755. Ticking the boxes shows each digit: owner 4 + 2 + 1 = 7, group 4 + 1 = 5, others 4 + 1 = 5. The command is chmod 755 script.sh.
Common values
- 644 for regular files, 755 for scripts and folders.
- 600 for private keys and secrets, 700 for private folders.
- Avoid 777, which lets anyone change the file.
