Linux chgrp and chown commands are commonly used by administrators. For beginners of Linux system management, the specific usage of Linux chgrp and chown commands is described here.
Linux chgrp command
Function: Change the group to which a file or directory belongs.
Syntax: chgrp [Option] group filename?
This command changes the user group to which the specified file belongs. The group can be either the user group ID or the group name of the user group in the/etc/group file. A file name is a list of files separated by spaces to change the group. Wildcards are supported. If the user is not the owner or super user of the file, the file group cannot be changed.
The options of this command are as follows:
-R recursively changes the group of all subdirectories and files in a specified directory.
Linux chown command
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. Users can be user names or user IDs. 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.
Linux chgrp and chown commands are used here.
- Brief Introduction to Linux Firewall Configuration modification commands
- Brief Introduction to Linux kernel Security Intrusion Detection System
- Detailed analysis of Linux Process Scheduling time
- Detailed analysis of Linux Firewall Configuration
- Detailed analysis of Linux folder execution Permissions