Symbolic: -rwxr-xr-x · Owner full access, group & others read/execute · Standard for directories & scripts
chmod 755 (0755)LOW RISKSSH KEY REJECTED
4-digit: 0755
Dir: drwxr-xr-x
Presets:
Interactive Permission Matrix (3×3 + Special Bits)-rwxr-xr-x
Scope
Read (4)
Write (2)
Execute (1)
Digit Sum
Owner (u)
4(r) + 2(w) + 1(x) = 7
Group (g)
4(r) + 1(x) = 5
Others (o)
4(r) + 1(x) = 5
Special Mode Bits (4th Leading Octal Digit)0 (none)
File / Dir Symbolic
-rwxr-xr-x / drwxr-xr-x
Binary Bitmask
111 101 101
umask Complement
Dir 022 · File 022
umask 022 creates dirs as 755 and files as 644 (files require explicit chmod +x).
Security Audit & Command Builder
Clean Least-Privilege Permission Set: Mode 755 restricts write access to the owner and avoids world-writable or SUID escalation risks.
OpenSSH Audit (SSH KEY REJECTED):OpenSSH rejects private keys with 0755: "Permissions 0755 for 'id_ed25519' are too open. UNPROTECTED PRIVATE KEY FILE!" Run chmod 600 instead.
Apply Permission (Octal & Symbolic)
chmod 755 /var/www/html
Symbolic: chmod u=rwx,g=rx,o=rx /var/www/html
Recursive chmod -R
chmod -R 755 /var/www/html
Safe Recursive Split (Dirs vs Files via find)
find /var/www/html -type d -exec chmod 755 {} +
find /var/www/html -type f -exec chmod 644 {} +
Verify Permissions with stat
stat -c "%a %A %U:%G %n" /var/www/html
macOS/BSD: stat -f "%Op %Sp %Su:%Sg %N" /var/www/html
Universal Linux default for public directories (web roots, /usr/local/bin, static asset folders) and executable scripts or compiled binaries runnable by all users.
Standard regular files (HTML/CSS/JS web assets, public configs, SSH .pub keys)
Why Linux Directories and Executables Standardize on chmod 755
chmod 755 (-rwxr-xr-x) is the default permission mode for directories created under umask 0022 and for system executables in /usr/bin and /usr/local/bin. The owner can read, modify, and execute (or add/delete files inside a directory), while group members and other users can traverse directories, list contents, and execute binaries without being able to alter anything.
Avoid running chmod -R 755 across an entire web root: setting the execute bit on plain HTML, CSS, JSON, or uploaded files is sloppy hygiene and adds unnecessary risk. Keep directories at 755 and regular files at 644 with find /var/www/site -type d -exec chmod 755 {} + && find /var/www/site -type f -exec chmod 644 {} +.
Why do web server directories need chmod 755 while files need chmod 644?
On Linux, a directory execute (+x) bit means "permission to traverse and open files inside", so Nginx/Apache needs 755 on folders. Static files do not need to be executed, so 644 is cleaner and safer.
Is chmod 755 safe for production web servers?
Yes for public directories and CLI scripts when owned by a deploy user separate from the web worker (www-data). For sensitive private folders, tighten to 750 or 700.
Does chmod 755 clear an existing SGID bit on a directory?
No! In GNU chmod, 3-digit chmod 755 preserves an existing SGID bit on directories. Use chmod 00755 or chmod g-s to explicitly clear SGID.