权限位由9位组成,每3位一组,共3组,r.可读(4),w.可写(2),x.可执行(1) -(0)没有任何权限。
权限管理命令: chmod [{ugoa} {±=} {rwx}] [文件或目录] [mode=421] [文件或目录] -R递归修改 功能:改变文件或目录权限. eg: [root@localhost ~]# chmod o+r ysx.txt [root@localhost ~]# 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
[root@localhost ~]# chmod -R 755 kkkkkk/ [root@localhost ~]# ll kkkkkk/ total 0 drwxr-xr-x 2 root root 6 Apr 6 20:03 hhhhh [root@localhost ~]# ls anaconda-ks.cfg hhhh.txt kkkkkk ysx.txt [root@localhost ~]# 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: [root@localhost ~]# chgrp ysx ysx.txt [root@localhost ~]# 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: [root@localhost ~]# chown ysx ysx.txt [root@localhost ~]# 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