linux chmod命令

老是手残把chmod打成chomd,zz

首先,介绍一下

chmod 更改文件权限的命令

一共有十个参数

drwxr-xr-x

前四个是用户,5-8,所属组,9-10 ,其他

r=读取属性  //值=4

w=写入属性  //值=2

x=执行属性  //值=1

具体实例

$ chmod u+x file                      给file的属主增加执行权限
$ chmod 751 file                     给file的属主分配读、写、执行(7)的权限,给file的所在组分配读、执行(5)的权限,给其他用户分配执行(1)的权限
$ chmod u=rwx,g=rx,o=x file           给file的属主分配读、写、执行(7)的权限,给file的所在组分配读、执行(5)的权限,给其他用户分配执行(1)的权限
 
其中的 u、g、o 分别代表的就是 user、group、others,"+"代表赋予权限,x (executable)代表可执行权。
 
$ chmod =r file                     为所有用户分配读权限
$ chmod 444 file                  为所有用户分配读权限
$ chmod a-wx,a+r   file           为所有用户分配读权限
$ chmod -R u+r directory            递归地给directory目录下所有文件和子目录的属主分配读的权限
$ chmod 4755                            设置用ID,给属主分配读、写和执行权限,给组和其他用户分配读、执行的权限。
 
 
最实用的就是这个chmod (-R) 775 file 给文件(加递归文件)775的权限

 

r=读取属性  //值=4 w=写入属性  //值=2 x=执行属性  //值=1

来自: http://man.linuxde.net/chmod
r=读取属性  //值=4 w=写入属性  //值=2 x=执行属性  //值=1

来自: http://man.linuxde.net/chmod
r=读取属性  //值=4 w=写入属性  //值=2 x=执行属性  //值=1

来自: http://man.linuxde.net/chmod
r=读取属性  //值=4 w=写入属性  //值=2 x=执行属性  //值=1

来自: http://man.linuxde.net/chmod
r=读取属性  //值=4 w=写入属性  //值=2 x=执行属性  //值=1

来自: http://man.linuxde.net/chmod
posted @ 2017-11-29 16:12  西贝小小凤  阅读(458)  评论(0编辑  收藏  举报