PasteZap
🌐 简体中文
免费 · 无需注册

免费 · 开发

chmod 权限计算器.

在八进制(755)与符号形式(rwxr-xr-x)之间转换 Unix 文件权限,支持 setuid、setgid 和粘滞位,并给出权限表和 chmod 命令。

开始之前

部分技术控件使用英语。支持 Unicode 文本;文件格式和输出语言取决于具体工具。

下面以英语列出技术限制。处理大型文件或使用结果之前,请先查看这些限制。

Loading the calculator…

换算 chmod 权限

  1. 输入八进制模式(如 755)或九个字母(如 rwxr-xr-x),也可以粘贴完整的 ls -l 行。
  2. 填写文件名即可得到可直接运行的 chmod 命令,或从常用预设开始。
  3. 查看表格,了解谁可以读取、写入和执行该文件。

示例:755 即 rwxr-xr-x:所有者可读、写、执行;所属组和其他人可读、执行。1777 加上粘滞位,变为 rwxrwxrwt,这是 /tmp 的常见模式。

数字的含义

  • 每一类(所有者、组、其他人)把读 = 4、写 = 2、执行 = 1 相加。因此 7 是 rwx,6 是 rw-,5 是 r-x。
  • 开头的第四位数字用于特殊位:setuid(4)、setgid(2)和粘滞位(1),在符号形式中显示为 s、s 和 t。
  • 常用模式:普通文件 644,脚本和目录 755,私钥 600。
  • 只涵盖标准 Unix 权限位,不包括 ACL 和 SELinux 标签。一切都在您的浏览器中完成。如需检查 SSH 密钥,请参阅 SSH 公钥指纹 工具;其他进制的数字请使用 进制转换器。

限制与支持格式

输入内容在您的设备上处理。

英语技术说明

Standard Unix permission bits only; ACLs and SELinux labels are not covered. Everything is calculated in your browser; nothing you type is uploaded.

Each class (owner, group, others) adds read = 4, write = 2 and execute = 1. A fourth leading digit sets setuid (4), setgid (2) and the sticky bit (1), shown as s, s and t in the symbolic form.

755 is rwxr-xr-x: the owner can read, write and run the file; group and others can read and run it. 1777 adds the sticky bit (rwxrwxrwt).

常见问题

chmod 755 是什么意思?

所有者可读、写、执行;组和其他人可读、执行。这是脚本和目录的典型权限。

应该用 chmod 777 吗?

很少需要。它允许所有用户修改文件。建议配合正确的组使用 755 或 775。

什么是粘滞位?

设在目录上时,即使其他人可以在该目录中写入,也只有文件所有者能删除或重命名文件,例如 /tmp。