chmod改变权限

来源:互联网 发布:迪杰斯特拉算法的应用 编辑:程序博客网 时间:2024/05/16 02:10
hmod 改变文件权限属性有两种方式:


* 数字

owner/group/others 组的 read/write/excute

r:4
w:2
x:1
例如 [-rwxrwx---] 是:
owner = rwx = 4+2+1 = 7
group = rwx = 4+2+1 = 7
others= --- = 0+0+0 = 0
 
例如 :chmod  754 test.txt
若要改变一个目录权限时 为  chmod -R 


* 字母 

u  (1)user 
g  (2)group
o  (3)others
a  (4)all

+(加入)
-(除去)
=(設定)
r 可读
w 可写
x 可执行

例如:  chmod u=rwx,g=rx,o=r filename  user(owner)=读写执行  group=读执行 other=读
 
  chmod  a+w  test.txt       all(user 、group 、other) 都增加写的权限    
  chmod  a-w   test.txt  all 都减去写的权限
0 0
原创粉丝点击