设置Linux文件和目录权限的方法

本文发布时间: 2019-Mar-21
1、字符表示法类型 操作 权限u + rg - wo = xa类型代表修改权限的对象,u表示文件的用户,g表示文件所有者的群组,o表示非用户组用户,a表示ugo操作 + 表示增加权限,- 表示减少权限,= 表示赋予权限权限 r 表示只读,w 表示可写,x 表示可执行[root@localhost ~] # mkdir perm[root@localhost ~] # cd perm[root@localhost perm] # mkdir test[root@localhost perm] # cd test[root@localhost test] # touch test1[root@localhost test] # touch test2以下是测试命令,具体见下图chmod u-w testchmod g+w testchmod ug+w testchmod ugo-x testchmod a+x testchmod o=w testchmod a= permchmod -R a+rwx perm2、数字表示法权限 数字r 4w 2x 1- 0例如rwx数字表示即4+2+1=7,实际上这是二进制表示,rwx三位bit,111,即7例子:chmod 577 testchmod 555 testchmod -R 754 test //-R 参数意为递归


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:08pm
栏目列表