是否有文件权限号的手册页?

是否有文件权限号的手册页?

是否有文件权限号的手册页?

我具体说的是

r = 4
w = 2
x = 1

我永远记不起它们,每次我需要设置除 755 之外的权限时,我都必须谷歌搜索。我也不认为我是孤独的,因为有甚至是一个为您计算数字的网站

我刚刚意识到手册页chmod没有任何数字描述,我不知道其他页面会有这些数字。我想一个info页面也可以工作,因为显然它是预先安装的(我有拱门;我以为我必须自己安装那个 - 显然不是)。如果我可以参考“在线”手册页(我在 参考资料中使用“在线” man man),那么对我来说会容易得多。

答案1

man chmod可能会给你命令行工具。这可能包括一些容易错过的文字

第二个数字选择拥有该文件的用户的权限:读取 (4)、写入 (2) 和执行 (1)

如果你man 2 chmod这样做了,那么你就会得到真正完成工作的系统调用。这很难读,但确实包含了神奇的数字:

   S_IRUSR  (00400)  read by owner
   S_IWUSR  (00200)  write by owner
   S_IXUSR  (00100)  execute/search  by owner ("search" applies for direc-
                     tories, and means that entries within  the  directory
                     can be accessed)
   S_IRGRP  (00040)  read by group
   S_IWGRP  (00020)  write by group
   S_IXGRP  (00010)  execute/search by group
   S_IROTH  (00004)  read by others
   S_IWOTH  (00002)  write by others
   S_IXOTH  (00001)  execute/search by others

它还提供了一些其他神奇的值:

   S_ISUID  (04000)  set-user-ID  (set  process  effective  user   ID   on
                     execve(2))

   S_ISGID  (02000)  set-group-ID  (set  process  effective  group  ID  on
                     execve(2);  mandatory  locking,   as   described   in
                     fcntl(2);  take a new file's group from parent direc-
                     tory, as described in chown(2) and mkdir(2))

   S_ISVTX  (01000)  sticky bit (restricted deletion flag, as described in
                     unlink(2))

相关内容