Linux File Permissions, Octal Codes & Chmod Command Cheat Sheet
Quick lookup guide for 777, 755, 644, 600, umask, sticky bits, and symbolic vs numeric permissions notation.
Table of Contents
Permission Representation: Octal Values & Bits
Binary bit weights and their corresponding numeric octal representations.
| Permission | Symbolic | Binary | Octal Value | Effect on File | Effect on Directory |
|---|---|---|---|---|---|
| Read | `r` | `100` | 4 | Read file contents | List files with `ls` |
| Write | `w` | `010` | 2 | Modify or truncate file | Create, rename, or delete files |
| Execute | `x` | `001` | 1 | Run script or binary program | Access (`cd`) and traverse directory |
Common Production Chmod Presets
Standard secure permission configurations for web servers (Nginx, Apache, Node.js).
| Octal Code | Symbolic Notation | Typical Target / Security Context |
|---|---|---|
| `600` | `-rw-------` | SSH Private Keys (`id_rsa`), AWS `.pem` keys, confidential credentials |
| `644` | `-rw-r--r--` | Standard public web files (HTML, CSS, JS, images, documents) |
| `700` | `drwx------` | User `~/.ssh` directory, root private home folders |
| `755` | `drwxr-xr-x` | Standard web directories, executable shell scripts (`deploy.sh`) |
| `777` | `drwxrwxrwx` | DANGER: Full read/write/execute for all users. Never use in production! |
Practical Terminal Commands
Day-to-day command snippets for managing permissions and ownership.
# Set all directories to 755 (read & execute)
find /var/www/html -type d -exec chmod 755 {} +
# Set all files to 644 (read only for others)
find /var/www/html -type f -exec chmod 644 {} +chmod 400 ~/.ssh/id_rsa
chmod 700 ~/.sshInteractive Client-Side Tools for this Guide
Test and run these patterns directly inside your browser with zero server uploads:
Linux Chmod Permissions Calculator & Command Generator
Calculate numerical and symbolic Linux file permissions with an interactive permission matrix. Generate terminal commands without memorizing octal values.
Online Cron Expression Generator & Human Explainer
Build cron schedule strings interactively or translate cryptic expressions into plain English. View next estimated runtimes with zero server latency.
Interactive Git Command Generator & Undo Cheatsheet
Never panic about broken Git history again. Generate precise commands for undoing commits, squashing changes, stashing work, and branch renaming.
Frequently Asked Questions
Why does SSH reject private keys with 644 permissions?
SSH strictly enforces privacy: a private key readable by other system users violates cryptographic trust. SSH refuses to authenticate until permissions are locked down to `400` or `600`.
How do I calculate chmod codes interactively?
Use DocSwift's free in-browser Chmod Calculator. Click permission checkboxes to generate numeric and symbolic strings instantly.