TToolbox
755

Chmod Calculator

Convert between octal and rwx permissions

About this tool

Chmod (Change Mode) is the command-line utility for managing file system access controls in Linux and Unix-like operating systems. It defines permissions across three scopes: User/Owner, Group, and Others, allocating Read (r=4), Write (w=2), and Execute (x=1) bits. Manually translating between octal notation (755, 644) and symbolic permissions (`rwxr-xr-x`) frequently causes security misconfigurations. This tool provides visual permission checkboxes, octal sync, and command generation.

How to Use This Tool (Step-by-Step)

1

Check Boxes or Type Octal Code

Toggle Read, Write, and Execute checkboxes across User, Group, and Other columns, or directly input an octal code like `755`.

2

Inspect Symbolic String & Command

The tool instantly synchronizes symbolic representations (`-rwxr-xr-x`) and formats ready-to-run shell commands.

3

Copy Production Shell Command

Copy the generated `chmod` command with one click for direct pasting into your SSH terminal, Dockerfile, or deployment script.

Bidirectional Octal & Symbolic Sync

Typing an octal number immediately toggles the checkboxes, while clicking checkboxes recalculates octal and symbolic values in real time.

SUID, SGID & Sticky Bit Support

Full support for advanced Unix special bits: SetUID (4), SetGID (2), and Sticky Bit (1, essential for shared `/tmp` folders).

100% Client-Side Privacy

Calculations execute entirely inside local browser memory. Internal server security configurations remain 100% confidential.

Directory Execution Rights & Security Gotchas

  • •Execute bit on directories: On files, `x` allows running binaries. On directories, `x` controls entry (`cd`) and access. Directories without `x` cannot be opened.
  • •Fix SSH 'Permissions are too open': OpenSSH rejects private keys accessible by other users. Run `chmod 600 ~/.ssh/id_rsa` to restore connection.
  • •Sticky Bit (`1777` on `/tmp`): The `t` flag ensures that while any user can write to the directory, users can only delete their own files, preventing sabotage.

Code & Transformation Examples

Common Linux Production File Permissions Benchmark

Classic Octal Codes
• 755 (-rwxr-xr-x) : 目录与可执行脚本标准权限 (属主读写执行,其他人只读执行)
• 644 (-rw-r--r--) : 普通网页文件、配置与图片标准权限 (属主读写,其他人只读)
• 600 (-rw-------) : 绝密文件 (仅属主可读写,如 SSH 密钥 ~/.ssh/id_rsa)
• 700 (-rwx------) : 私密脚本与安全目录 (仅属主全权操作)
• 777 (-rwxrwxrwx) : 危险!所有人全权可读写执行 (严禁在正式生产服务器滥用!)
Octal Math Addition
Read (读 r) = 4
Write (写 w) = 2
Execute (执行 x) = 1
例如 rwx = 4 + 2 + 1 = 7 ; r-x = 4 + 0 + 1 = 5 ; r-- = 4 + 0 + 0 = 4

* Each octal digit represents the simple arithmetic sum of Read (4), Write (2), and Execute (1) bits.

Linux Shell Bulk Recursive Chmod Snippet

Secure Recursive Normalization
# 将所有目录统一设置为 755 (目录必须有 x 执行权限才能进入)
find /var/www/html -type d -exec chmod 755 {} \;

# 将所有文件统一设置为 644 (普通文件绝不需要执行权限)
find /var/www/html -type f -exec chmod 644 {} \;
Security Warning
千万不要无脑执行 chmod -R 777 /var/www!这会赋予所有上传的文件可执行权限,黑客一旦上传 Webshell 脚本即可瞬间提权接管整台服务器!

* Separating directories (755) from files (644) via find is standard Unix hardening procedure.

Frequently Asked Questions

Q: Why is the maximum digit 7 in chmod?

A: Chmod uses octal (Base 8, digits 0–7). Three binary bits (rwx) max out at `111`, summing to `4 + 2 + 1 = 7`. Digits 8 and 9 do not exist in octal.

Q: What does symbolic syntax `chmod u+x,g-w` mean?

A: Symbolic mode modifies relative permissions: `u+x` adds execute to owner; `g-w` strips write from group. It adjusts specific flags without overwriting full states.

Q: What are the recommended permissions for a web server?

A: Standard hardening: Directories to `755`, static files to `644`, owned by deployment user. Grant write permissions exclusively to dedicated upload folders.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/