返回顶部
c

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 means, how to set file permissions, or what symbolic notation rwxr-xr-x translates to.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
100
下载量
0
收藏
概述
安装方式
版本历史

chmod-calc

# 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 | Numeric | Symbolic | Description | |---------|-------------|--------------------------------| | 644 | rw-r--r-- | Standard file (owner rw, rest r) | | 755 | rwxr-xr-x | Standard directory/executable | | 600 | rw------- | Private file (owner only) | | 700 | rwx------ | Private directory/executable | | 777 | rwxrwxrwx | Full access (avoid in production) | | 4755 | rwsr-xr-x | Setuid executable | | 2755 | rwxr-sr-x | Setgid executable | | 1755 | rwxr-xr-t | Sticky 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.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 chmod-calc-1776083290 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 chmod-calc-1776083290 技能

通过命令行安装

skillhub install chmod-calc-1776083290

下载 Zip 包

⬇ 下载 chmod-calc v1.0.0

文件大小: 2 KB | 发布时间: 2026-4-14 14:31

v1.0.0 最新 2026-4-14 14:31
Initial release of chmod-calc skill.

- Converts between numeric (octal) and symbolic file permission notations.
- Generates both numeric and symbolic chmod commands.
- Provides plain-English explanations for each permission set.
- Supports input as numeric code, symbolic string, or natural language description.
- Handles special permission bits: setuid, setgid, and sticky.
- Includes error handling for invalid input and warnings for insecure permissions (e.g., 777).

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部