Free tool

Linux Chmod Permissions Calculator

Visually calculate Linux octal and symbolic file permissions, configure SetUID/SetGID/Sticky bits, audit world-writable security risks, and copy safe chmod & chown commands.

Linux Chmod Permissions Calculator: the tool

One-Click Production Presets:
Least-Privilege Configuration (755)

No world-writable bits are enabled. This follows standard Linux least-privilege permissions for production servers.

Recommendation: Pair with accurate file ownership (`chown`) so your web or app service runs as a dedicated non-root user.

Permission Bit Matrix

Scope
Read
(4)
Write
(2)
Execute
(1)
Octal
Owner (u)
File creator / owner
7
Group (g)
Assigned group members
5
Public / Others (o)
All other system users
5
Special Permission Bits (4th Leading Octal Digit)Value: 0

Octal, Symbolic & CLI Output

Symbolic (`ls -l`)
drwxr-xr-x
Octal chmod Command
chmod 755 /var/www/app/
Symbolic chmod Command
chmod u=rwx,g=rx,o=rx /var/www/app/
Ownership (chown) Command
sudo chown www-data:www-data /var/www/app/

Hardening Linux VPS deployments, Docker containers, or CI/CD pipelines?

DEESU configures zero-downtime cloud infrastructure, least-privilege server hardening, and automated deployment workflows.

Audit My Infrastructure

How it works

How Linux Octal and Symbolic File Permissions Work

Every file and directory on a POSIX or Linux filesystem stores a 12-bit permission mode divided into four octal digits: Special Bits (SetUID, SetGID, Sticky), Owner (u), Group (g), and Others (o). Each of the three standard scopes combines three binary flags whose decimal weights sum cleanly into a single octal digit between 0 and 7.

Read (r) has a weight of 4, Write (w) has a weight of 2, and Execute (x) has a weight of 1. Because 4, 2, and 1 are powers of two, every sum maps uniquely to one combination of flags: 7 (4+2+1) grants full rwx, 6 (4+2) grants rw-, 5 (4+1) grants r-x, and 4 grants read-only r--. When you run ls -l, Linux renders those exact bits as a 10-character symbolic string such as -rw-r--r-- (a regular file with mode 644) or drwxr-xr-x (a directory with mode 755).

Files vs. Directories: Why Execute (x) Means Something Different

A common point of confusion for engineers deploying Linux servers is why web directories need 755 while the HTML, CSS, or .env files inside them only need 644 or 600. On regular files, the Execute (x) bit permits the kernel to run the file as a program or shell script. Giving a static image, JSON config, or PHP template execute permission is unnecessary.

On directories, however, the three permission bits govern directory operations rather than program execution:

  • Read (r, 4) on a directory allows listing filenames inside it (e.g., running ls).
  • Write (w, 2) on a directory allows creating, renaming, or deleting files inside it (requires x to take effect).
  • Execute (x, 1) on a directory is the 'traverse' or 'search' bit—it allows cd into the directory and accessing known file paths inside it. Without x, even reading a readable file inside the folder fails with Permission Denied.

Understanding Special Permission Bits: SetUID, SetGID, and Sticky Bit

The optional leading fourth octal digit controls three advanced Linux kernel behaviors. SetUID (4xxx, shown as s in the owner execute slot) causes an executable binary to run with the file owner's user ID rather than the caller's—classic examples include /usr/bin/passwd and sudo. SetGID (2xxx, shown as s in the group execute slot) is especially useful on shared team directories: new files created inside a 2775 directory automatically inherit the directory's group instead of the creator's primary group.

The Sticky Bit (1xxx, shown as t in the others execute slot) protects shared directories like /tmp (1777). Even though every user can create files inside /tmp, the sticky bit ensures users can only delete or rename files they personally own (or if they are root).

Production Security Hardening: Why You Should Never Use chmod 777

When troubleshooting Nginx, Docker volume mounts, or PHP/Node.js upload errors, reaching for chmod -R 777 is one of the most dangerous habits in DevOps. Mode 777 grants every local user and compromised background daemon unrestricted write and execute access. On a multi-tenant host or web server, an attacker exploiting a minor read/write bug in another service can immediately overwrite your application scripts or plant a web shell.

Instead, solve permission errors by aligning ownership (chown -R appuser:appgroup /var/www/app) and applying least-privilege modes: 755 for directories, 644 for public static assets, 600 for .env secrets and SSH private keys (~/.ssh/id_ed25519), and 400 for immutable TLS private keys.

FAQ

Questions, answered

OpenSSH enforces strict permission checks on private keys (~/.ssh/id_ed25519 or .pem cloud keys) to protect against credential theft on shared servers. If Group or Others have any read, write, or execute bits set (such as 644 or 664), SSH aborts with 'WARNING: UNPROTECTED PRIVATE KEY FILE'. Setting chmod 600 (owner read/write) or chmod 400 (owner read-only) immediately resolves the error.

Mode 644 (-rw-r--r--) lets the owner read and edit a file while everyone else can only read it—ideal for static web assets, config files, and source code. Mode 755 (-rwxr-xr-x or drwxr-xr-x) adds the Execute bit for all three scopes, which is required for directories (to allow traversal) and executable scripts or binaries.

A lowercase s (SetUID/SetGID) or t (Sticky Bit) means the special bit AND the underlying execute (x) bit are both enabled. An uppercase S or T indicates that the special bit is set WITHOUT the corresponding execute bit (for example, 4644 produces -rwSr--r--).

Running chmod -R 755 makes every file executable, which is undesirable. Instead, combine find with chmod: run find /var/www/app -type d -exec chmod 755 {} + for directories, and find /var/www/app -type f -exec chmod 644 {} + for regular files.

The leading digit represents the Special Bits (SetUID=4, SetGID=2, Sticky=1). Writing 0644 explicitly clears all three special bits, whereas 3-digit 644 leaves existing special bits untouched on some systems. Explicit 4-digit notation is preferred in automation scripts, Dockerfiles, and Ansible/Terraform manifests.

More free tools

Reply within 1 business day

Tell us what you're building.

Send the problem, not a polished brief. We'll tell you what it actually takes to ship it: stack, timeline and cost, before you commit to anything.