修改权限

1.权限
r读 w写 x执行
read write excutable
4 2 1
2.修改权限
chmod (chang mode)
(1)修改数字
[root@lsr7 ~]# ll huahua.txt
-rw-r--r--. 3 root root 73 Apr 9 15:55 huahua.txt
[root@lsr7 ~]# chmod 755 huahua.txt
[root@lsr7 ~]# ll huahua.txt
-rwxr-xr-x. 3 root root 73 Apr 9 15:55 huahua.txt
(2)修改字母
[root@lsr7 ~]# chmod u-w huahua.txt
[root@lsr7 ~]# ll huahua.txt
-r--r--r--. 3 root root 73 Apr 9 15:55 huahua.txt
[root@lsr7 ~]# chmod u+x huahua.txt
[root@lsr7 ~]# ll huahua.txt
-r-xr--r--. 3 root root 73 Apr 9 15:55 huahua.txt

[root@lsr7 ~]# chmod u=w huahua.txt //把rwx全部替换成一个w
[root@lsr7 ~]# ll huahua.txt
--w-r--r--. 3 root root 73 Apr 9 15:55 huahua.txt

[root@lsr7 ~]# chmod ugo=x huahua.txt
[root@lsr7 ~]# ll huahua.txt
---x--x--x. 3 root root 73 Apr 9 15:55 huahua.txt

[root@lsr7 ~]# chmod ugo+x huahua.txt //属主属组其它全部增加上执行权限
[root@lsr7 ~]# ll huahua.txt
--wxr-xr-x. 3 root root 73 Apr 9 15:55 huahua.txt

[root@lsr7 ~]# chmod 777 huahua.txt
[root@lsr7 ~]# ll huahua.txt
-rwxrwxrwx. 3 root root 73 Apr 9 15:55 huahua.txt

[root@lsr7 ~]# chmod +x huahua.txt
[root@lsr7 ~]# ll huahua.txt
-rwxrwxrwx. 3 root root 73 Apr 9 15:55 huahua.txt

[root@lsr7 ~]# chmod a+x huahua.txt
[root@lsr7 ~]# ll huahua.txt
-rwxrwxrwx. 3 root root 73 Apr 9 15:55 huahua.txt

你可能感兴趣的:(修改权限)