Explain how to use chgrp and chown commands in Linux

Source: Internet
Author: User

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.

  1. Brief Introduction to Linux Firewall Configuration modification commands
  2. Brief Introduction to Linux kernel Security Intrusion Detection System
  3. Detailed analysis of Linux Process Scheduling time
  4. Detailed analysis of Linux Firewall Configuration
  5. Detailed analysis of Linux folder execution Permissions

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.