#chown命令: Changes the file's owner and host groups by Chown. When you change the owner or group of a file, you can use the user name and user identification code settings. A normal user cannot change his or her files to another owner. Its operation permissions are generally administrators.
Modified file owner and owner group:
[[Email Protected]_168_102_centos ~]# ls-8drwxr-xr-x 2 Wanghan HX 4096-10:32 abedrwxr
C5>-xr-x 2 root wanghan 409610:32~ ~]# ls-8drwxr-xr-x 2 root root 4096 10:32 abedrwxr-xr-x 2 root wanghan 4096-10:32 Xab
[[Email Protected]_168_102_centos ~~]# ls-8drwxr-xr-x 2 user1 wanghan 4096-10:32 AB Edrwxr-xr-x 2 root wanghan 4096 10:32 Xab
To modify only the group of files:
[[Email Protected]_168_102_centos ~]# ls-8drwxr-xr-x 2 user1 wanghan 4096-10:32 abedrwxr >-xr-x 2 root wanghan4096 10:32~ ~]# ls-8drwxr-xr-x 2 user1 root 4096 abedrwxr-xr-x 2 root wanghan 4096 10:32 10:32 xab
Modify the owner of the file and belong to the group automatically modified to its owner corresponding to the genus Group
[[Email Protected]_168_102_centos ~]# ls-8drwxr-xr-x 2 user1 root 4096-10:32 abedrwxr
C3>-xr-x 2 root wanghan4096 10:32~ ~]# ls-8drwxr-xr-x 2 Wanghan HX 40 abedrwxr-xr-x 2 root wanghan 4096 10:32 10:32 xab
Chown–r: The owner or group of the recursive processing file
[Email protected]_168_102_centos tmp]# LS-Ltotal4srwxrwxrwx1 root root 0 9 10:05Agent_cmd.sock-RW-------1 root root 0 4 13:58AP_1014.PIDDRWXR-xr-x 3 Wanghan wanghan 4096 11 15:52ceshi[[email protected]_168_102_centos tmp]# ls-L ceshi/ Total4drwxr-xr-x 2 Wanghan wanghan 4096 11 15:52 123[email protected]_168_102_centos tmp]# chown-R Root:root ceshi/[[email protected]_168_102_centos tmp]# ls-L Total4srwxrwxrwx1 root root 0 9 10:05Agent_cmd.sock-RW-------1 root root 0 4 13:58AP_1014.PIDDRWXR-xr-x 3 root root 4096 11 15:52ceshi[[email protected]_168_102_centos tmp]# ls-L ceshi/ Total4drwxr-xr-x 2 root root 4096 11 15:52 123
#chgrp命令: Modifying a file group
[[Email Protected]_168_102_centos tmp]# ls-41 root root 0 9 10:05 Agent_cmd.sock -rw-------1 root root 0 4 13:58 ap_1014.piddrwxr-xr-x 3 root root 4096-15:52-
4
1 root root 0 9 10:05
agent_cmd.sock-rw-------1 root root 0 4 13:58
ap_1014.piddrwxr-xr-x 3 root wanghan 4096-15:52 Ceshi
Chgrp-r: Recursive processing
[Email protected]_168_102_centos tmp]# LS-Ltotal4srwxrwxrwx1 root root 0 9 10:05Agent_cmd.sock-RW-------1 root root 0 4 13:58AP_1014.PIDDRWXR-xr-x 3 root root 4096 11 15:52ceshi[[email protected]_168_102_centos tmp]# ls-L ceshi/ Total4drwxr-xr-x 2 root root 4096 11 15:52 123[email protected]_168_102_centos tmp]# chgrp-R user1 ceshi/[[email protected]_168_102_centos tmp]# ls-Ltotal4srwxrwxrwx1 root root 0 9 10:05Agent_cmd.sock-RW-------1 root root 0 4 13:58AP_1014.PIDDRWXR-xr-x 3 root user1 4096 11 15:52ceshi[[email protected]_168_102_centos tmp]# ls-L ceshi/ Total4drwxr-xr-x 2 root user1 4096 11 15:52 123
#chmod命令: