首页 > 系统服务 > 详细

设置 Linux 文件和文件夹权限的方法

时间:2016-04-03 18:50:22      阅读:107      评论:0      收藏:0      [点我收藏+]

1、字符表示法

类型 操作 权限

u + r

g - w

o = x

a


类型代表改动权限的对象,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 test

chmod g+w test

chmod ug+w test

chmod ugo-x test

chmod a+x test

chmod o=w test

chmod a= perm

chmod -R a+rwx perm

技术分享


2、数字表示法

权限 数字

r 4

w 2

x 1

- 0


比如rwx数字表示即4+2+1=7,实际上这是二进制表示,rwx三位bit,111,即7


样例:

chmod 577 test

chmod 555 test

chmod -R 754 test //-R 參数意为递归

技术分享

设置 Linux 文件和文件夹权限的方法

原文:http://www.cnblogs.com/bhlsheji/p/5350303.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!