What is chmod?
chmod (change mode) is a Unix command that sets file and directory permissions — who can read, write, or execute a file. The numeric codes like 755 or 644 encode these permissions.
Permission Bits
Each file has three sets of permissions: owner, group, and others. Each set has three bits: read (4), write (2), execute (1). Add them together for the numeric code:
7= read + write + execute (4+2+1)6= read + write (4+2)5= read + execute (4+1)4= read only0= no permissions
Common Permission Codes
755— owner: full; group+others: read & execute. Standard for directories and scripts.644— owner: read & write; group+others: read only. Standard for static files.600— owner: read & write; group+others: none. For private keys and config files.777— everyone: full permissions. Insecure on servers; avoid.400— owner: read only. For files that must not be modified (e.g. SSH private keys).
Syntax
chmod 755 myscript.sh — sets the file to 755.
chmod -R 755 /var/www/html — applies 755 recursively to all files and subdirectories.
Calculate chmod permissions and see exactly what each code means: Open chmod Calculator →
Frequently Asked Questions
What does chmod 755 mean?
Owner has read, write, and execute (7). Group and others have read and execute (5). Standard for directories and executables.
Why is chmod 777 bad?
It grants write and execute access to everyone on the system. On a web server, any user process could overwrite or execute the file — a major security risk.