linux chmod permissions sysadmin cheat-sheet security

Chmod Calculator & Linux File Permissions Guide

A comprehensive reference for Linux file permissions, symbolic vs. octal notation, and chmod commands. Learn how to use a chmod calculator to secure your files.

2026-04-20 Use This Tool

Chmod Calculator & Linux File Permissions Guide

In the world of Linux and Unix, managing who can read, write, or execute a file is a fundamental security task. The chmod (change mode) command is the primary tool for this. Whether you're a web developer fixing a "403 Forbidden" error or a sysadmin hardening a server, understanding file permissions is crucial.

This guide explains how Linux permissions work, the difference between octal and symbolic notation, and how to use a Chmod Calculator.


1. Understanding the Permission Structure

Every file and directory in Linux has three sets of permissions, each containing three types of access.

The Three Tiers (Who)

  • User (u): The owner of the file.
  • Group (g): Members of the file's group.
  • Others (o): Everyone else on the system.

The Three Access Types (What)

Symbol Access Type Octal Value Description
r Read 4 Open and view the file content.
w Write 2 Modify or delete the file.
x Execute 1 Run the file as a program/script.
- None 0 No access allowed.

2. Symbolic vs. Octal Notation

There are two ways to represent and change permissions:

Octal Notation (Numbers)

Permissions are calculated by adding the values of each access type.

  • 7 (4+2+1): read, write, and execute
  • 6 (4+2): read and write
  • 5 (4+1): read and execute
  • 4: read-only

Example: chmod 755 myfile

  • User: 7 (rwx)
  • Group: 5 (r-x)
  • Others: 5 (r-x)

Symbolic Notation (Letters)

Uses characters to represent who and what is being changed.

  • chmod u+x myfile: Add execute permission for the user.
  • chmod g-w myfile: Remove write permission for the group.
  • Example: chmod u=rwx,g=rx,o=rx myfile (Same as 755)

3. Common Chmod Commands

Command Permission Use Case
chmod 777 rwxrwxrwx Dangerous! Everyone can do anything. Use only for testing.
chmod 755 rwxr-xr-x Standard for public directories and scripts.
chmod 644 rw-r--r-- Standard for public files (readable by all, writable only by owner).
chmod 600 rw------- Private files (e.g., SSH keys, configuration files).
chmod 400 r-------- Read-only private files.

4. Advanced Permissions: SUID, SGID, and Sticky Bit

Beyond basic rwx, Linux uses special bits for specific behaviors:

  • SUID (4000): When a file is executed, it runs with the permissions of the owner.
  • SGID (2000): Files created in a directory inherit the group of the directory.
  • Sticky Bit (1000): Only the owner of a file (or root) can delete or rename files in a directory (common for /tmp).

5. Using a Chmod Calculator

Calculating octal values manually (like "rwx r-x r-x" = 755) can be error-prone. A Chmod Calculator allows you to simply check boxes for the permissions you want, and it generates the correct octal or symbolic command for you.

While we don't have a dedicated chmod tool yet, you can use our Unit Converter for base conversions (like binary to decimal) which is the underlying logic of file permissions!


FAQ: File Permission Troubleshooting

Q: I get "Permission Denied" even with sudo. Why?

A: sudo gives you root privileges, but it doesn't bypass certain file system restrictions (like an immutable bit) or network file system (NFS) permissions. Also, check if the parent directory has the execute (x) bit set, which is required to "enter" a directory.

Q: How do I change permissions recursively?

A: Use the -R flag. For example, chmod -R 755 /my/directory/ will apply the permissions to the directory and all files/subdirectories inside it.

Q: What is the difference between sudo and chmod?

A: chmod changes the rules of the file. sudo (Substitute User Do) allows you to act as a different user (usually root) who has the authority to change those rules.


Related on Tool3M

  • Unit Converter: Useful for understanding binary/decimal logic in file permissions.
  • Base64 Encoder: Often used when handling configuration files and binary data.
  • JSON Formatter: Validate your configuration files after setting correct permissions.