Why chmod 644 (rw-r--r--) Is the Default Permission for Linux Files
Octal permission 644 (symbolic representation -rw-r--r--) is the universal default file mode created by a standard Linux umask 022 when a process creates a new non-executable file. Under chmod 644, the file owner holds Read (4) and Write (2) privileges (4 + 2 = 6, rw-), while members of the file group and all other system users hold Read-Only (4, r--) access with zero write or execute bits set.
Because the execute bit (1) is cleared across all three security scopes (owner, group, public), the Linux kernel refuses to invoke a chmod 644 file as a standalone binary or script even if it contains a #!/bin/bash shebang header. This makes chmod 644 the standard permission for web assets (HTML, CSS, JS, SVG, PNG), /etc/nginx/nginx.conf configuration files, /etc/systemd/system/*.service unit definitions, and public SSH keys (~/.ssh/id_ed25519.pub).
- Owner Bitmask 6 (4 Read + 2 Write = rw-): Allows the file owner or deployment pipeline to read and update file contents without marking the file executable.
- Group Bitmask 4 (4 Read = r--): Grants read-only access to the assigned group (such as web server workers reading static assets).
- Public Bitmask 4 (4 Read = r--): Allows non-privileged system daemons to read non-secret configuration files and public web documents.
When Not to Use chmod 644: Secret Keys & Directories
Never apply chmod 644 to files containing credentials, database passwords (.env), or private SSH keys (~/.ssh/id_rsa), because any local user account on the server can read world-readable (4) files—OpenSSH explicitly rejects private keys with 644 permissions and requires chmod 600. Likewise, never apply chmod 644 to a directory, as removing the execute bit prevents users from entering or listing files inside that directory.
- Private Keys & .env Files Require chmod 600: Revoke group and world read access with chmod 600 so multi-tenant users cannot inspect API secrets.
- Directories Require Execute Traversal (chmod 755): Setting a directory to 644 blocks cd and stat calls on child files; always keep directories at 755 or 750.
Practical Real-World Use Cases
Mode 0644 is the standard baseline permission for non-secret, non-executable files across Linux infrastructure:
- Static Web Assets (HTML, CSS, JS, SVG & WebP): Ensure compiled frontend bundles inside /var/www or container layers are readable by Nginx workers without carrying unnecessary execute bits.
- Systemd Service Units & /etc Configuration Files: Install /etc/systemd/system/app.service, /etc/hosts, and /etc/nginx/conf.d/*.conf as root:root 0644 to eliminate systemd "marked executable" journal warnings.
- Public SSH Keys (~/.ssh/id_ed25519.pub) & TLS Certificates: Keep public .pub keys and fullchain.pem X.509 certificates at 0644 while locking their paired private keys strictly to 0600.
Frequently Asked Questions
Why does chmod 644 correspond to umask 022 in Linux?
Linux file creation starts from base mode 666 (rw-rw-rw-) for regular files and subtracts the active process umask (022), stripping write permissions (2) from group and public scopes to yield 644 (rw-r--r--).
Is chmod 644 safe for .env files or private SSH keys?
No. chmod 644 makes a file readable by every user account on the machine. Use chmod 600 (rw-------) for .env files, TLS private keys, and ~/.ssh/id_ed25519 private keys.