linux - 使用八进制表示法设置权限

标签 linux unix octal

我知道权限是使用 Chmod 设置的,但我很难理解如何将八进制数转换为权限。

例如

640 does this mean that the user has rw-r----x permission? Becuase 4+2=6 and 4 = w and 0 = - ?

I understand that 777 is wide open because the user has full control fo the file 4+2+1 = 7 rwx permission the group has rwx and the second group has rwx permission If I were to answer this question my answer would be. rw-r----x What am I doing wrong?

最佳答案

有 3 个数字。第一位是用户权限,第二位是组权限,第三位是其他人的权限。

每个数字都是通过将 4(读取)、2(写入)、1(执行)的子集相加而形成的。

因此6 4 0表示允许用户(6)读写(4 + 2),组(4) ) 允许读取 (4),其他人 (0) 没有权限。

关于linux - 使用八进制表示法设置权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32854560/

相关文章:

linux - 128 字节 Ext2 和 256 字节 Ext3 的 inode 数据结构差异

linux - 比较一组词的出现

java - jar 在 unix 和 linux 中的行为是否不同?

java - 00在Java中是整数还是八进制?

java - Java 中的八进制到文本

python - 如果在某些程序正在从该文件读取数据时删除输入文件,会发生什么情况?

linux - POSIX 进程间同步

linux - 如何在 "indirect"ssh 连接中传输文件?

linux - Linux 中存储的 `history` 命令的内容在哪里?为什么对终端的 SIGKILL 不会阻止它存储命令?

linux - "continuous"带八进制转储的输出