Linux-chown command

Source: Internet
Author: User

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.

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.