Chmod & Linux File Permissions Calculator

Interactive Linux and Unix file permissions calculator: convert chmod octal modes (755, 644, 600, 777) and symbolic strings (rwxr-xr-x) with SUID/Sticky bits.

Owner

Group

Public

Understanding Unix & Linux File Permissions

In Unix-like operating systems (including Linux, macOS, and BSD), chmod (short for "change mode") is the fundamental command-line utility used to define who can access, modify, and execute files and directories. File permissions are stored as a 12-bit bitmask inside the filesystem inode data structure.

Permissions are strictly segmented across three independent user classes:

  • Owner (User / u): The specific user account that owns the file or directory. The owner always retains authority to modify file permissions.
  • Group (g): A collection of users who belong to the file's assigned group. This enables team-based and service-based collaboration without granting full administrative privileges.
  • Others (Public / o): All other accounts and system processes that have access to the operating system.

Octal Notation vs. Symbolic Syntax: The Binary Math

Each user class has three permission bits: Read (r), Write (w), and Execute (x). In POSIX systems, each bit corresponds to a power of 2:

  • Read (r): Value 4 (binary 100). Allows reading the contents of a file or listing entries in a directory.
  • Write (w): Value 2 (binary 010). Allows modifying or appending to a file, or creating/deleting files within a directory.
  • Execute (x): Value 1 (binary 001). Allows running an executable program or entering/traversing a directory.

By summing these numbers, each user class receives a single octal digit ranging from 0 (---, no permissions) to 7 (rwx, full permissions):

Read (4) + Write (2) + Execute (1) = 7 (rwx)
Read (4) + No Write (0) + Execute (1) = 5 (r-x)
Read (4) + Write (2) + No Execute (0) = 6 (rw-)

A mode like 755 translates to: Owner has 7 (rwx), Group has 5 (r-x), and Others have 5 (r-x). In symbolic command-line syntax, this can be set via chmod u=rwx,go=rx filename or simply chmod 755 filename.

Files vs. Directories: Why the Execute (x) Bit Differs

A frequent point of confusion among system administrators is that permission bits mean fundamentally different things on files versus directories:

  • On a File: The r bit permits opening and reading file bytes; w allows editing; x allows the kernel to execute the file as an ELF binary or script.
  • On a Directory: The r bit permits reading the directory stream to list filenames (e.g., running ls). However, the x (Search/Traverse) bit is strictly required to navigate into the directory (cd), read file metadata (like file sizes and modification dates via stat), or open files inside it!

If a directory has 644 (rw-r--r--), users will experience an immediate "Permission denied" error when attempting to access any file inside it! This is why web servers require directories to have 755 while regular HTML, CSS, and JS files use 644.

Special 4-Digit Bits: SUID, SGID, and the Sticky Bit

POSIX filesystems support an optional leading 4th octal digit that activates special kernel execution behaviors:

  • SUID (Set User ID, 4000): When an executable with SUID is run by an unprivileged user, it temporarily executes with the privileges of the file owner. Classic example: /usr/bin/passwd (mode 4755) runs as root so standard users can update their hashed passwords in /etc/shadow.
  • SGID (Set Group ID, 2000): On directories (mode 2775), any new file created inside automatically inherits the parent directory's group ownership rather than the creator's primary group. This is vital for shared team folders.
  • Sticky Bit (1000): Applied to shared public directories (most famously /tmp with mode 1777). It allows anyone to create files, but strictly prevents users from deleting or renaming files owned by others.

Security Hardening: The Extreme Dangers of 'chmod 777'

When troubleshooting web server permission errors, internet tutorials frequently recommend running chmod -R 777. This is an extremely hazardous practice that creates severe security vulnerabilities:

  • Mode 777 grants every user and local system process unrestricted write and execute access. If an attacker discovers an arbitrary file upload flaw or local file inclusion (LFI) in your web application, a 777 directory allows them to write a web shell script and immediately execute it, taking full control of the server.
  • Recommended Production Standards:
    • SSH Private Keys (~/.ssh/id_rsa): 600 (read/write only by owner; OpenSSH will reject keys with looser permissions).
    • SSH Public Keys (~/.ssh/id_rsa.pub): 644.
    • SSH Configuration Directory (~/.ssh/): 700.
    • Web Document Root Files: 644.
    • Web Document Root Directories: 755.

Practical Real-World Use Cases

  • Make a deployment script executable: Calculate the exact octal mode (such as 755 or 700) needed so a runner can execute a shell script.
  • Lock down web server assets: Determine the right permission modes to keep static files readable (644) and directories traversable (755) without granting write access.
  • Troubleshoot Permission denied errors: Translate an existing symbolic (-rw-r-----) or octal (640) permission string to see which user class (owner, group, or others) lacks access.
  • Write accurate runbook commands: Verify what a chmod command actually grants before adding it to deployment documentation or a Dockerfile.
  • Audit overly permissive files: Check why a 777 or 666 mode is insecure and identify the minimum privileges required for the workload.

Absolute Privacy

Your filesystem planning is completely confidential. OmniTools operates on a strict "Zero Server Upload" architecture. When you calculate permissions or plan access control masks for your production servers, all conversions between octal, binary, and symbolic modes execute strictly inside your local web browser using client-side JavaScript.

We never track, store, or transmit the permissions you calculate or the server file paths you are configuring.

Frequently Asked Questions

How do you calculate Linux chmod permissions like 755, 644, and 600?

Each digit represents Owner, Group, and Others by summing Read (r = 4), Write (w = 2), and Execute (x = 1). Chmod 755 (rwxr-xr-x) gives the owner full access (4+2+1=7) and read/execute to others (4+1=5), standard for web directories and executable scripts. Chmod 644 (rw-r--r--) is standard for regular files, and chmod 600 (rw-------) secures private SSH keys.

Why is chmod 777 dangerous on a Linux server?

Chmod 777 (rwxrwxrwx) grants read, write, and execute permissions to every user and process on the system. If a web application has an upload or file-inclusion flaw, an attacker can write and execute a malicious script immediately.

What are the special 4-digit chmod permissions (SUID, SGID, Sticky Bit)?

The leading fourth octal digit sets SUID (4000, run executable as file owner), SGID (2000, inherit parent directory group ownership), and Sticky Bit (1000, prevent users from deleting others’ files in shared directories like /tmp with mode 1777).