CentOS文件权限

CentOS文件权限
权限位由9位组成,每3位一组,共3组,r.可读(4),w.可写(2),x.可执行(1)
-(0)没有任何权限。

权限管理命令:
chmod [{ugoa} {±=} {rwx}] [文件或目录]
[mode=421] [文件或目录]
-R递归修改
功能:改变文件或目录权限.
eg: [[email protected] ~]# chmod o+r ysx.txt
[[email protected] ~]# ll
total 12
-rw-------. 1 root root 1383 Apr 5 14:13 anaconda-ks.cfg
-rw-r–r-- 1 root root 174 Apr 6 07:13 hhhh.txt
-rw-r–r-- 1 root root 20 Apr 6 06:38 ysx.txt

[[email protected] ~]# chmod -R 755 kkkkkk/
[[email protected] ~]# ll kkkkkk/
total 0
drwxr-xr-x 2 root root 6 Apr 6 20:03 hhhhh
[[email protected] ~]# ls
anaconda-ks.cfg hhhh.txt kkkkkk ysx.txt
[[email protected] ~]# ll
total 12
-rw-------. 1 root root 1383 Apr 5 14:13 anaconda-ks.cfg
-rw-r–r-- 1 root root 174 Apr 6 07:13 hhhh.txt
drwxr-xr-x 3 root root 18 Apr 6 20:03 kkkkkk
-rw-r–r-- 1 root root 20 Apr 6 06:38 ysx.txt

chgrp change file group ownership /bin/chgrp 所有用户都可执行。
chgrp [用户组] [文件或目录]
功能:改变文件或目录的所属组
eg: [[email protected] ~]# chgrp ysx ysx.txt
[[email protected] ~]# ll
total 12
-rw-------. 1 root root 1383 Apr 5 14:13 anaconda-ks.cfg
-rw-r–r-- 1 root root 174 Apr 6 07:13 hhhh.txt
drwxr-xr-x 3 root root 18 Apr 6 20:03 kkkkkk
-rw-r–r-- 1 root ysx 20 Apr 6 06:38 ysx.txt

chown change file ownership /bin/chown 所有用户
chown [用户] [文件或目录]
功能:改变文件或目录的所有者
eg: [[email protected] ~]# chown ysx ysx.txt
[[email protected] ~]# ll
total 12
-rw-------. 1 root root 1383 Apr 5 14:13 anaconda-ks.cfg
-rw-r–r-- 1 root root 174 Apr 6 07:13 hhhh.txt
drwxr-xr-x 3 root root 18 Apr 6 20:03 kkkkkk
-rw-r–r-- 1 ysx ysx 20 Apr 6 06:38 ysx.txt