1. Role
Change the owner and owner group of one or more files or directories. The usage permission is superuser. 2. Format
chown [Options] User or group file 3. Main parameters
–dereference: Affected is the object indicated by the symbolic link, not the symbolic link itself.
-h,–no-dereference: The symbolic link itself is affected, not the destination indicated by the symbolic link (this option is valid when the system supports changing the owner of the symbolic link).
–from= Current owner: The current group changes the owner and group only if the owner and group of each file match the options specified. One of them can be omitted, and this omitted attribute does not need to conform to the original property.
-f,–silent,–quiet: Remove most of the error messages.
-r,–recursive: Recursively process all files and subdirectories.
-v,–verbose: Processing Any file will display information. 4. Description
Chown the owner of the specified file to the specified user or group, the user can be either a user name or a user ID, a group can be a group name or a group ID, and a file is a space separate list of files to change permissions, and wildcard characters are supported. System administrators often use the Chown command to let a user have permission to use the file after copying it to another user's directory. 5. Application Examples
1. Change the owner of the file Shiyan.c to Wan
$ chown Wan Shiyan.c
2. Change the owner of the directory/hi and all the files and subdirectories under it to the WAN, and change the group to users.
$ chown-r Wan.users/hi
Suppose there is a user hrb, to add him to the HLJ group, you should use that command.
Usermod-g Hlj HRB