The core answer: how chmod octal math works

When you run a command like chmod 755 index.php, you are passing three distinct permission values to the Linux kernel: the first digit applies to the Owner (User), the second digit to the Group, and the third digit to Others (everyone else on the system).

Each digit is calculated by adding three base weights:

Because 4, 2, and 1 are powers of two (binary 100, 010, 001), any combination yields a unique number between 0 and 7. For example, 4 + 2 + 1 = 7 represents full rights, while 4 + 0 + 1 = 5 represents read and execute only.

Chmod 755 permissions in calculator showing rwxr-xr-x

Figure 1: Chmod 755 representation in our interactive calculator: Owner has Read/Write/Execute, Group and Others have Read/Execute.

The Big Three: 755, 644, and 600 explained

1. Chmod 755 (rwxr-xr-x) — Directories and executable scripts

755 is the industry standard for Linux folders (like /var/www/html) and standalone binaries.

Crucial Linux detail: On directories, the execute bit (x) does not mean "running a program". It represents traversal rights. If a directory lacks execute permissions (e.g. 644), users and web server daemons (such as www-data or nginx) cannot enter the directory (via cd) or access files inside it, even if the files themselves have read permissions.

2. Chmod 644 (rw-r--r--) — Static web files and documents

644 is the universal baseline for standard files: HTML documents, CSS stylesheets, images, and config files.

Because static documents should never be executed as programs by the CPU, the execute bit is omitted (0). This prevents malicious users from tricking the system into running an uploaded JPG or text file as a script.

Chmod 644 permissions showing rw-r--r--

Figure 2: Chmod 644 breakdown: Owner read/write, Group read-only, Others read-only.

3. Chmod 600 (rw-------) — Secrets, SSH keys, and credentials

600 isolates sensitive files completely from anyone other than the primary owner.

Use chmod 600 on your ~/.ssh/id_rsa private keys, .env files containing database passwords, and API key stores. If your SSH private key permissions are set to 644 or 755, OpenSSH clients will refuse to authenticate and print:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/home/user/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.

Fix it instantly with: chmod 600 ~/.ssh/id_rsa.

Chmod 600 permissions showing rw-------

Figure 3: Chmod 600: strictly isolated file access for private credentials.

Why chmod 777 is a dangerous antipattern

When a developer encounters a "Permission Denied" error on a web server or WordPress upload directory, a frequent temptation is running chmod -R 777 wp-content/.

Chmod 777 gives Read, Write, and Execute authority to every single account and daemon on the operating system. If any website hosted on that server is compromised, or if a vulnerability in a third-party library allows arbitrary file uploads, an attacker can directly upload a PHP script into that 777 folder, execute it via HTTP, and gain remote shell access.

The proper fix for "Permission Denied": Instead of changing permissions to 777, fix the ownership of the directory so that the web server user owns it:

# On Ubuntu/Debian (Nginx / Apache):
sudo chown -R www-data:www-data /var/www/html/uploads

# Keep permissions standard:
find /var/www/html/uploads -type d -exec chmod 755  +
find /var/www/html/uploads -type f -exec chmod 644  +

Permissions quick reference table

Octal Symbolic Common Usage Security Risk
755 rwxr-xr-x Directories, bash scripts, binaries Low (Standard)
644 rw-r--r-- HTML, images, stylesheets, documents Low (Standard)
600 rw------- SSH private keys, .env, DB configs Secure (Private)
700 rwx------ Personal ~/.ssh directory, private scripts Secure (Private)
666 rw-rw-rw- Shared serial ports or temp buffers Medium (Writable by all)
777 rwxrwxrwx Testing sandbox only Critical (Do not use)

Special permissions: SUID, SGID, and Sticky Bit

In addition to basic three-digit permissions, Unix filesystems support an optional leading fourth digit:

Try the interactive calculator

If you want to quickly convert permissions without doing manual binary math, use our free Chmod Calculator. Toggle checkboxes to see the octal string update in real time, or type an octal code to inspect the exact symbolic flags.

🧮 Toggle permission checkboxes and generate terminal commands with visual octal and symbolic feedback:
Open Interactive Chmod Calculator→

Frequently asked questions

What does chmod 755 mean in plain English?

Chmod 755 grants Read, Write, and Execute permissions to the file owner (7 = 4+2+1), and Read and Execute permissions to both the group and all other users (5 = 4+0+1). In symbolic notation, this is rwxr-xr-x. It is the universal standard for Linux web directories and executable scripts.

Why do directories need execute (x) permissions in Linux?

In Linux file systems, the execute bit on a directory controls traverse rights. Without the execute permission (x), you cannot enter the folder using the cd command, nor can a web server (like Nginx or Apache) look up or read files inside that folder, even if the files themselves have read permissions (644).

What is the difference between chmod 755 and 644?

Chmod 755 allows execution (running binaries or entering directories), making it ideal for folders and scripts. Chmod 644 (rw-r--r--) provides Read and Write to the owner, but only Read access to everyone else with no execution rights, making it the secure standard for static files, HTML, CSS, and images.

Why does SSH refuse connections with "Permissions are too open"?

OpenSSH clients enforce strict security checks on private key files (~/.ssh/id_rsa). If your private key has permissions looser than 600 (such as 644 or 755), other local accounts could read your private credential. SSH will abort with the error "WARNING: UNPROTECTED PRIVATE KEY FILE!". Running chmod 600 ~/.ssh/id_rsa fixes the issue.

Why is chmod 777 dangerous in web hosting and production?

Chmod 777 gives every user and process on the server unrestricted ability to read, modify, and delete the file. If an attacker exploits a file upload vulnerability or compromised CMS plugin, a 777 folder allows them to plant executable web shells, deface pages, or overwrite critical system scripts.

What is the Sticky Bit (chmod 1777)?

The sticky bit (indicated by a leading 1 in octal or a "t" in symbolic notation) is applied to shared directories like /tmp. It allows all users to write new files to the directory, but prevents them from deleting or renaming files owned by other users.