Linux Chmod Calculator & Permissions Generator (Interactive Tool)

Use this interactive Linux Chmod Calculator to instantly generate numeric (octal) and symbolic permissions. Select the checkboxes below or pick an enterprise preset to see the exact chmod command, permission string, and security risk assessment.






👤 Owner (User)
7



👥 Group
5



🌐 Others (Public)
5



Numeric Octal
0755

Symbolic Notation
-rwxr-xr-x

$


Understanding Linux File Permissions: The Complete Reference Guide

In Unix and Linux operating systems, every file and directory is bound by a granular security permissions model. The command chmod stands for “Change Mode” and is used to define who can read, modify, or execute files on the system.


1. The Three Permission Tiers (Who)

Linux organizes file permissions across three distinct user categories:

  • User (Owner): The specific user account that owns the file.
  • Group: The group of users granted shared access to the file.
  • Others (Public / World): Any other authenticated or unauthenticated user on the system.

2. How Octal (Numeric) Notation Works

Each permission type corresponds to a binary and numeric value:

  • Read (r): 4 β€” Allows viewing the contents of a file or listing files inside a directory.
  • Write (w): 2 β€” Allows modifying, appending, or deleting file contents.
  • Execute (x): 1 β€” Allows running a binary or script as a process, or entering (cd) into a directory.

To calculate the total permission for a category, you simply sum the numbers:

  • 4 + 2 + 1 = 7 (Full: Read, Write, Execute)
  • 4 + 2 + 0 = 6 (Read & Write)
  • 4 + 0 + 1 = 5 (Read & Execute)
  • 4 + 0 + 0 = 4 (Read-Only)
  • 0 + 0 + 0 = 0 (No access allowed)

3. Files vs. Directories: The “Execute” Difference

A common misunderstanding among junior engineers is the meaning of the Execute (x) permission:

  • On a File: Execute permission allows the kernel to load and run the file (e.g., a Bash script ./script.sh or binary executable).
  • On a Directory: Execute permission does NOT mean running a program. It grants permission to traverse (enter) the directory using cd and access file metadata inside it. A directory with read (r) but no execute (x) allows listing filenames, but forbids reading file sizes, permissions, or accessing their contents!

4. Common Enterprise Chmod Scenarios

Numeric Symbolic Recommended Use Case
644 -rw-r--r-- Standard web files (HTML, CSS, images, PHP files). Owner can edit; web server can read.
755 drwxr-xr-x Web document directories (public_html), system binaries (/usr/bin), and shell scripts.
600 -rw------- SSH private keys (~/.ssh/id_rsa) and sensitive password configurations (.env, wp-config.php).
700 drwx------ Private user directories, SSH directory (~/.ssh), and root-only utilities.
777 -rwxrwxrwx NEVER USE IN PRODUCTION. Grants universal write and execution to any local user or web process.

5. Recursive Permissions: Separate Files and Folders

When deploying web applications or fixing permissions across thousands of files, administrators frequently make the mistake of running chmod -R 755 /var/www. This makes all static text and image files unnecessarily executable!

Instead, use the find command to apply 755 to directories and 644 to files recursively:

# 1. Set all directories to 755
find /var/www/html -type d -exec chmod 755 {} +

# 2. Set all files to 644
find /var/www/html -type f -exec chmod 644 {} +

6. Frequently Asked Questions (FAQ)

Q: Why does OpenSSH reject my private key?

OpenSSH strictly requires that your private key cannot be viewed or altered by other users. If your private key has permissions like 644 or 777, SSH will abort with “Permissions 0644 for ‘/root/.ssh/id_rsa’ are too open”. Always set private keys to chmod 600 ~/.ssh/id_rsa.

Q: What is a umask in Linux?

The umask (User Mask) is a default system setting that subtracts permissions when new files or directories are created. For example, a default umask of 022 subtracts write permissions from group and others, automatically resulting in 755 for new directories and 644 for new files.

Q: What are SUID, SGID, and Sticky Bits?

These are special 4th-digit permissions:

  • SUID (4000): Executes the file with the privileges of the file owner (e.g. /usr/bin/passwd runs as root).
  • SGID (2000): Executes with the privileges of the group, or causes files created inside a directory to inherit the directory’s group ownership.
  • Sticky Bit (1000): Applied to shared directories like /tmp (chmod 1777 /tmp). It allows all users to write files, but only the file’s owner can delete their own files.