您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

Unix与Linux文件权限的含义是什么

2024/4/25 2:36:01发布4次查看
文件权限st_mode
含义
八进制值
英文注记
s_irusr
用户读
4
read user
s_iwusr
用户写
2
write user
s_ixusr
用户执行
1
exec user
s_irgrp
组读
4
read group
s_iwgrp
组写
2
write group
s_ixgrp
组执行
1
exec group
s_iroth
其他用户读
4
read other
s_iwoth
其他用户写
2
write other
s_ixoth
其他用户执行
1
exec other
这也对应了我们常见的chmod 755, 上面的表格可以分成三组, 每组最大值为7,表示读写执行权限. 下面用c代码来看看具体值:
#include <stdio.h>#include <sys/stat.h>/*s_irusr: 使用者读权限, read user 4s_iwusr: 使用者写权限, write user 2s_irgrp: 组用户读权限, read group 4s_iroth: 其他用户读权限, read other 4*/int main(int argc, char const *argv[]) {    printf(        s_irusr, s_iwusr, s_irgrp, s_iroth=%o, %o, %o, %o, (s_irusr | s_iwusr         | s_irgrp | s_iroth)=%o\n,        s_irusr, s_iwusr, s_irgrp, s_iroth,        (s_irusr | s_iwusr | s_irgrp | s_iroth));    return 0;}
结果:
s_irusr, s_iwusr, s_irgrp, s_iroth=400, 200, 40, 4, (s_irusr | s_iwusr | s_irgrp | s_iroth)=644
以上就是unix与linux文件权限的含义是什么的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录