← 返回
未分类 中文

Chmod Calc

Calculate chmod permissions — convert between numeric (octal) and symbolic notation, and generate the chmod command. Use when the user asks what chmod 755 me...
{ "result": "计算 chmod 权限 — 在数字(八进制)和符号表示之间转换,并生成 chmod 命令。用于用户询问 chmod 755 … 的场景。" }
ohernandez-dev-blossom
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 411
下载
💾 0
安装
1
版本
#latest

概述

chmod Calculator

Convert file permission specifications between numeric (octal) and symbolic notation, and produce the corresponding chmod command.

Input

  • Either a numeric permission string (e.g. 755, 644, 4755)
  • Or a description of permissions per entity (owner/group/others with read/write/execute)
  • Or a symbolic string (e.g. rwxr-xr-x)

Output

  • Numeric notation (3 or 4 digits)
  • Symbolic notation (9 characters, e.g. rwxr-xr-x)
  • Numeric chmod command: chmod 755 filename
  • Symbolic chmod command: chmod u+rwx,g+rx,o+rx filename
  • Plain-English description of what each entity can do

Instructions

Permission bit values

Each entity (owner/group/others) is a sum of:

  • Read (r) = 4
  • Write (w) = 2
  • Execute (x) = 1

Special permission bits (4th leading digit)

  • Setuid = 4 (runs as owner)
  • Setgid = 2 (runs as group)
  • Sticky = 1 (only owner can delete in directory)

Numeric → Symbolic conversion

Given a 3-digit octet OGO:

  • For each digit, decompose: r if bit 2 set, w if bit 1 set, x if bit 0 set, else -.
  • With leading special digit S: setuid sets s/S in owner execute position; setgid sets s/S in group execute position; sticky sets t/T in others execute position.

Symbolic → Numeric conversion

Map each 3-char group to a digit using the bit values above.

Symbolic chmod command format

Build clauses for each entity with permissions set:

  • u = owner, g = group, o = others
  • Emit {entity}+{perms} for each entity that has any permissions
  • Special bits: u+s (setuid), g+s (setgid), +t (sticky)

Common permission reference

NumericSymbolicDescription
------------------------------------------------------
644rw-r--r--Standard file (owner rw, rest r)
755rwxr-xr-xStandard directory/executable
600rw-------Private file (owner only)
700rwx------Private directory/executable
777rwxrwxrwxFull access (avoid in production)
4755rwsr-xr-xSetuid executable
2755rwxr-sr-xSetgid executable
1755rwxr-xr-tSticky directory

Options

  • Input can be numeric, symbolic, or a plain-English description of desired permissions.

Examples

Input: 755

Output:

Numeric:          755
Symbolic:         rwxr-xr-x
Command (numeric):   chmod 755 filename
Command (symbolic):  chmod u+rwx,g+rx,o+rx filename

Owner: read, write, execute
Group: read, execute
Others: read, execute

Input: 644

Output:

Numeric:          644
Symbolic:         rw-r--r--
Command (numeric):   chmod 644 filename
Command (symbolic):  chmod u+rw,g+r,o+r filename

Owner: read, write
Group: read
Others: read

Input: rwxr-xr-x

Output:

Numeric:          755
Symbolic:         rwxr-xr-x
Command (numeric):   chmod 755 filename
Command (symbolic):  chmod u+rwx,g+rx,o+rx filename

Input: "owner can read and write, group can read, others nothing"

Output:

Numeric:          640
Symbolic:         rw-r-----
Command (numeric):   chmod 640 filename
Command (symbolic):  chmod u+rw,g+r filename

Error Handling

  • If numeric input has more than 4 digits or contains non-octal characters, say so.
  • If a digit in the octet exceeds 7, explain that each permission digit must be 0–7.
  • If symbolic input is not exactly 9 or 10 characters in valid format, ask for clarification.
  • Warn the user if they request 777 that this allows full access to everyone and is a security risk.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-31 05:51 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Shared Brain

ohernandez-dev-blossom
跨多个AI代理的共享持久记忆层。适用于首次设置多代理工作空间,或代理发现永久...
★ 0 📥 437

Base64 Encode

ohernandez-dev-blossom
使用 Base64、URL 百分号编码或 HTML 实体对文本进行编码或解码。当用户请求编码、解码、Base64 编码/解码、URL 编码等操作时使用。
★ 0 📥 421

Case Convert

ohernandez-dev-blossom
将文本在不同命名格式之间转换,如驼峰式、下划线式、连字符式、帕斯卡式、全大写、全小写、标题式等。
★ 0 📥 486