💻 Coding

Chmod Linux Permissions Calculator

Calculate Linux file permissions visually. Convert between octal numbers (755, 644) and symbolic notation (-rwxr-xr-x) with zero server tracking.

Standard Presets:
Octal Mode
0755
Symbolic String
-rwxr-xr-x
Type
Tier / Class Read (4) Write (2) Execute (1)
Owner (u)
Group (g)
Others (o)
Special Bits
Terminal Commands

    

Understanding Linux File Permissions and the Chmod Command

Quick Answer: In Linux and Unix filesystems, chmod (short for "change mode") controls file system permissions across three distinct user classes: Owner (User), Group, and Others (World). Permissions are defined by three foundational operations: Read (4), Write (2), and Execute (1). Summing these bit values generates three-digit octal codes like 755 (rwxr-xr-x) for directories and scripts, or 644 (rw-r--r--) for standard documents, establishing fine-grained security boundaries across the operating system.

Every file, directory, socket, and pipe created in POSIX-compliant operating systems like Linux, macOS, FreeBSD, and OpenBSD stores metadata within its inode. This metadata defines who owns the resource, which group shares administrative access, and what specific actions any system process can perform. The chmod utility is the primary administrative command used to inspect and adjust these discretionary access control flags.

The Anatomy of POSIX Permissions: User Classes

Unix security categorizes processes and system accounts into three distinct tiers of authority when evaluating access requests:

The Mathematical Foundation: Octal and Binary Weights

Behind every human-readable permission string lies a 9-bit binary bitmask stored in the filesystem inode. Each of the three user classes is governed by a 3-bit triplet representing Read, Write, and Execute rights. Because 3 binary bits can represent values from 0 (000) to 7 (111), Linux maps these triplets cleanly to the base-8 octal numbering system:

The Complete Octal Combinations Table

Octal Digit Binary Bitmask Symbolic String Effective Access Capability
0 000 --- No permissions granted. Complete access denial.
1 001 --x Execute only. Can execute program or traverse folder, but cannot read or modify.
2 010 -w- Write only. Blind write capability without read access (rarely used).
3 011 -wx Write and execute. Can write files and traverse, but cannot read or list contents.
4 100 r-- Read only. Can view file contents or list directory files; no modifications allowed.
5 101 r-x Read and execute. Standard directory traversal and binary execution mode.
6 110 rw- Read and write. Standard document and editable data file mode without execution.
7 111 rwx Full access. Unrestricted capability to read, write, modify, and execute.

File Types in Symbolic Directory Listings

When executing ls -l in a terminal, the output string begins with a 10-character sequence (such as -rwxr-xr-x or drwxr-xr-x). The first character identifies the file system object type rather than an access privilege:

Special Permission Bits: SUID, SGID, and the Sticky Bit

Beyond standard read, write, and execute bits, Linux provides three advanced permission flags controlled by an optional fourth leading octal digit:

Understanding Umask and Default File Modes

When a program or user creates a new file, the operating system does not assign arbitrary permissions. Instead, the process specifies a base mode, which the kernel filters through the current process umask (user creation mask):

Production Hardening: Safe Permission Recipes

Applying proper permissions is critical to safeguarding Linux servers against privilege escalation and data theft:

The Hazards of Chmod 777 and Anti-Patterns

One of the most dangerous and common mistakes in server administration is running chmod 777 -R to resolve a "Permission Denied" error. Setting mode 777 grants read, write, and execute authority to every account on the system. If your web application contains an arbitrary file upload vulnerability, any remote attacker can upload a web shell and execute arbitrary commands with ease. In addition, any malicious local process or unprivileged daemon can overwrite system scripts, corrupt databases, or delete critical directories.

Safe Bulk Permission Updates: The Find Pattern

A common operational challenge occurs when deploying web applications or extracting archives where file and directory permissions have become inconsistent. Running chmod -R 755 /path/to/site is problematic because it assigns the execute bit to every text file, stylesheet, and image, violating security best practices.

The standard, production-grade solution uses the POSIX find command with parallel execution markers to separate directories from regular files:

# Correctly set directories to 755 without affecting files
find /var/www/my-app -type d -exec chmod 755 {} +

# Correctly set regular files to 644 without stripping directory traversal
find /var/www/my-app -type f -exec chmod 644 {} +

# Lock down sensitive environment secrets
chmod 600 /var/www/my-app/.env

Symbolic vs Octal Modes in Daily Workflows

The chmod command accepts two distinct input styles:

Troubleshooting Permission Denied Errors

When debugging access issues in Linux environments, consider the complete authentication chain:

Frequently Asked Questions

What does chmod 755 mean in Linux permissions?

Chmod 755 sets permissions so the file owner has read, write, and execute permissions (7), while the group and all other users have read and execute permissions (5). In symbolic notation, this is represented as rwxr-xr-x.

How are numeric chmod values calculated?

Chmod values are calculated by summing the numeric weights of assigned permissions: Read equals 4, Write equals 2, and Execute equals 1. For example, read plus execute gives 5 (4+1), and full access gives 7 (4+2+1).

What do the three digits in chmod 755 or 644 represent?

The three digits represent distinct user classes in order: the first digit applies to the file Owner (u), the second to the Group (g), and the third to Others (o). Each digit is the independent sum of read, write, and execute permissions for that class.

What is the recommended permission for web server files and directories?

Standard security guidelines recommend 755 (drwxr-xr-x) for web directories so web servers can traverse and list them, and 644 (-rw-r--r--) for web assets like HTML, CSS, and images to allow reading while preventing unauthorized execution or modification.

Why is using chmod 777 dangerous in production environments?

Chmod 777 grants read, write, and execute permissions to all users on the operating system. Any compromised local process, rogue daemon, or unauthorized user can modify, overwrite, execute, or delete those files, creating severe security vulnerabilities.

What permission should be assigned to private SSH keys?

OpenSSH strictly requires private key files like id_rsa to have permissions restricted to chmod 600 (-rw-------) or chmod 400 (-r--------). If permissions are too open, SSH clients will refuse to authenticate and reject the key connection.

What are special permissions like SUID, SGID, and the Sticky Bit?

Special permissions use a fourth leading octal digit: SUID (4) executes a binary with the permissions of the file owner, SGID (2) executes with the group privileges or enforces directory group inheritance, and the Sticky Bit (1) prevents non-owners from deleting files in shared directories like /tmp.

What is umask and how does it determine default file permissions?

The umask (user file-creation mode mask) is an octal filter subtracted from base system permissions when creating new files (base 666) or directories (base 777). A standard umask of 022 results in default file permissions of 644 and directory permissions of 755.

How do you change permissions recursively on directories versus files?

To avoid breaking web servers by setting execution bits on plain files, use find commands instead of chmod -R. Run find . -type d -exec chmod 755 {} + for directories and find . -type f -exec chmod 644 {} + for files.

Does this chmod calculator transmit my file names or server data?

No. All calculation logic runs entirely within your browser using client-side JavaScript. No file paths, usernames, server commands, or session data are ever sent across the network.