Command name: chown
Permission: root
Usage: chown [-cfhvR] [-- help] [-- version] user [: group] file...
Note: Linux/Unix is a multi-person, multi-job operating system. All archives have owners. Chown can be used to change the owner of an archive. Generally, this command is only used by the system administrator (root). Generally, users do not have the permission to change the owner of another user's archive or change their owner to another user. Only the system administrator (root) has such permissions.
Parameter description
User: user ID of the new archive owner
Group: User group of the new archive owner)
-C: If the archive owner has changed, the change action is displayed.
-F: If the archive owner cannot be changed, do not display an error message.
-H: only the link is changed, not the file actually pointed to by the link.
-V: displays the details of the owner's changes.
-R: Change the owner of all files and sub-directories in the current directory in the same way (that is, change one by one in the way of delivery)
-- Help: displays auxiliary instructions
-- Version: displays the version.
Example
Set the owner of the file file1.txt to user jessie of the users Group:
Chown jessie: users file1.txt
Set all files in the current directory and sub-directory owner to user lamport of users Group:
Chown-R lamport: users *
Function: Modify the owner and group of a file or directory. This command is also very common. For example, if the root user copies a file to xu, the root user should set the owner of the file to xu to allow xu to access the file. Otherwise, user xu cannot access this file.
Syntax: chown [Option] user or group file
Note: chown will change the owner of a specified file to a specified user or group. The user can be a user name or user I D. A group can be a group name or group ID. Files are separated by spaces to change the permission list. Wildcards are supported. The options of this command are as follows:
-R recursively changes the owner of all subdirectories and files under a specified directory.
-V: displays the work done by the chown command.
Both chgrp and chown transfer the file owner, but chown can only be converted in the same user group, while chgrp can be transferred to different user groups.