chrgp是文件属组修改命令,此命令只能修改文件数组。
chgrp [OPTION]...GROUP FILE...
chgrp [OPTION]...--reference=RFILE FILE...
-R:递归操作
[root@localhost ~]# chgrp root file 
[root@localhost ~]# ls -l file 
-rw-r--r-- 1 ley root 0 11-12 10:20 file
-R:
[root@localhost ~]# chgrp -R root directory/
[root@localhost ~]# ll directory/
总计 0
-rw-r--r-- 1 ley root 0 11-12 10:27 a
-rw-r--r-- 1 ley root 0 11-12 10:27 b
-rw-r--r-- 1 ley root 0 11-12 10:27 c


chmod命令更改文件的权限
chmod语法参数:
chmod [OPTION]...MODE[,MODE]...FILE...
chmod [OPTION]...OCTAL-MODE FILE...
chmod [OPTION]...--reference=RFILE FILE...
-R:递归操作
[root@localhost ~]# touch file
[root@localhost ~]# makdir directory
-rw-r--r-- 1 root root       0 11-12 10:41 file
drwxr-xr-x 2 root root    4096 11-12 10:41 directory
说明:管理员用户的umask的默认权限是022 ,所有创建出来的文件权限是644,目录权限是755
[root@localhost ~]# chmod 777 file  数字表示法
[root@localhost ~]# ll file 
-rwxrwxrwx 1 root root 0 11-12 10:41 file
[root@localhost ~]# chmod o= file
[root@localhost ~]# ll file 
-rwxrwx--- 1 root root 0 11-12 10:41 file 字符表示法
[root@localhost ~]# chmod g-rwx file
[root@localhost ~]# ll file 
-rwx------ 1 root root 0 11-12 10:41 file
[root@localhost ~]# chmod -R 700 directory/
[root@localhost ~]# ll -d directory/
drwx------ 2 root root 4096 11-12 10:41 directory/
扩展:文件属主和属组的特殊情况
-rw-r--r-- 1 501 501 4 Feb 20 13:14 tset.txt
说明:这种情况是系统中没有的属主用户被删除了,此文件只显示了UID和GID