Symbolic: -rw-r--r-- · Owner read/write, group & others read-only · Default Linux file mode
chmod 644 (0644)LOW RISKSSH KEY REJECTED
4-digit: 0644
Dir: drw-r--r--
Presets:
Interactive Permission Matrix (3×3 + Special Bits)-rw-r--r--
Scope
Read (4)
Write (2)
Execute (1)
Digit Sum
Owner (u)
4(r) + 2(w) = 6
Group (g)
4(r) = 4
Others (o)
4(r) = 4
Special Mode Bits (4th Leading Octal Digit)0 (none)
File / Dir Symbolic
-rw-r--r-- / drw-r--r--
Binary Bitmask
110 100 100
umask Complement
Dir 133 · File 022
umask 022 creates files as 644 (dirs as 755).
Security Audit & Command Builder
Clean Least-Privilege Permission Set: Mode 644 restricts write access to the owner and avoids world-writable or SUID escalation risks.
OpenSSH Audit (SSH KEY REJECTED):OpenSSH rejects private keys with 0644: "Permissions 0644 for 'id_ed25519' are too open. UNPROTECTED PRIVATE KEY FILE!" Run chmod 600 instead.
Apply Permission (Octal & Symbolic)
chmod 644 filename
Symbolic: chmod u=rw,g=r,o=r filename
Recursive chmod -R
chmod -R 644 filename
Safe Recursive Split (Dirs vs Files via find)
find filename -type d -exec chmod 755 {} +
find filename -type f -exec chmod 644 {} +
Universal Linux default for regular non-executable files: HTML/CSS/JS web assets, source code, Markdown docs, public SSH keys (.pub), and non-secret configs.
Standard web directories & executable binaries/scripts (/var/www/html, /usr/local/bin)
chmod 644 vs 755: The Golden Rule for Web Servers and Linux Files
chmod 644 (-rw-r--r--) is the universal Linux standard for regular files created under the default umask 0022. The file owner can read and edit the file, while group members and other users (including Nginx or Apache worker processes) have read-only access and no execute bit. Using 644 for HTML, CSS, JS, JSON, images, and PHP/Python source files prevents accidental execution and stops web workers from overwriting application files.
Never run chmod -R 644 on a web directory tree: stripping the execute (+x) bit from directories immediately triggers HTTP 403 Forbidden because the OS cannot traverse a 644 directory. Instead, always separate directories (755) from files (644) using two safe find commands: find /var/www/site -type d -exec chmod 755 {} + and find /var/www/site -type f -exec chmod 644 {} +.
What is the difference between chmod 644 and chmod 755?
chmod 644 (-rw-r--r--) is for regular non-executable files. chmod 755 (-rwxr-xr-x) adds the execute bit, which is required for directories (traversal) and executable scripts/binaries.
Why did chmod -R 644 break my Nginx website with 403 Forbidden?
Because chmod -R 644 also removed the execute (+x) bit from subdirectories. Restore directories to 755 with find /var/www/html -type d -exec chmod 755 {} + while keeping files at 644.
Is chmod 644 safe for .env or SSH private key files?
No. Because 644 allows all local users to read the file, sensitive files like .env and SSH private keys should use chmod 600 (or 640 if a dedicated service group needs read access).