Unix File Permissions Explained (chmod 755, 644)

chmod 755 = rwxr-xr-x (owner: all, group: read+execute, others: read+execute). chmod 644 = rw-r--r--. Each octal digit is the sum of read (4), write (2), and execute (1). Three digits set permissions for owner, group, and others respectively.

Permission Number Reference

NumberLettersMeaning
7rwxRead + Write + Execute
6rw-Read + Write
5r-xRead + Execute
4r--Read only
2-w-Write only
1--xExecute only
0---No permissions

Common chmod Values

chmodSymbolicUse Case
755rwxr-xr-xDirectories, executables, scripts
644rw-r--r--Regular files (HTML, CSS, images)
600rw-------Private keys, credentials
700rwx------Private directories (.ssh)
777rwxrwxrwxEveryone can do everything (avoid!)

Examples

# Set file permissions
chmod 644 index.html
chmod 755 deploy.sh
chmod 600 ~/.ssh/id_rsa

# Check permissions
ls -la file.txt
# -rw-r--r--  1 user group  1234 Apr 11 12:00 file.txt

# Symbolic mode
chmod u+x script.sh    # Add execute for owner
chmod go-w file.txt    # Remove write for group and others

Frequently Asked Questions

How do Unix permission numbers work?

Each digit is the sum of: read (4) + write (2) + execute (1). Three digits represent owner, group, and others. So 755 means: owner=7 (rwx), group=5 (r-x), others=5 (r-x).

Why should I never use chmod 777?

chmod 777 gives everyone read, write, and execute access. This is a security risk because any user on the system can modify or execute the file. Use the minimum permissions necessary.

Built by Michael Lip. 100% client-side — no data leaves your browser.