Linux System chown Command parsing

Source: Internet
Author: User

Chown command

Command description: Linux/unix is a multi-person multi-work system, all files are owned by the owner. The chown can be used to change the owner of the file. Generally speaking, this instruction is only used by the system administrator (root), the general user does not have the authority to change the other person's file owner, and does not have the authority to change the owner of their own files to other persons. Only the system administrator (root) has this permission.

Usage rights: Root

How to use: Chown [-CFHVR] [--help] [--version] user[:group] File ...

Parameter description:

-C or-change: The function is similar to-V but only returns the modified part.

-F or –quiet or –silent: Error message is not displayed.

-H or –no-dereference: Only modify the symbolic linked files without changing any other related files.

-R or-recursive: recursively handles all files and subdirectories under the specified directory.

-V or –verbose: Displays the instruction execution process.

–dereference: The effect is exactly the opposite of-H.

–reference=< reference file or directory;: Sets the owner of the specified file or directory and the owning group to the same owner of the referenced file or directory as the owning group.

Help: Displays online instructions.

User: The user ID of the new file owner.

Group: The user Group (group) of the new file owner.

–version: Displays version information.

Set Value:

-RW-------(600)--only the master has read and write permission.

-rw-r--r--(644)--only the master has read and write permission, and the group user and other users have Read permission only.

-RWX------(700)--only the owner has read, write, and execute permissions.

-rwxr-xr-x (755)-The master has read, write, execute permission, but the group user and other users only read, execute permissions.

-rwx--x--x (711)-The master has read, write, execute permissions, but the group user and other users only execute permissions.

-rw-rw-rw-(666)--All users have file read and write permissions. This approach is undesirable.

-RWXRWXRWX (777)-All users have read, write, and execute permissions. More undesirable approach.

Here are two general settings for the directory:

DRWX------(700)-only the owner can read and write in the directory.

Drwxr-xr-x (755)-All users can read the directory, but only the owner can change the contents of the directory

Example:

Chown [-r] [user name] [file or directory]

CHOWN[-R] [user name: Group name] [file or directory]

1) chown Test:root test3.txt Change the owner of the Test3.txt file to test user.

2) Chown:test Test3.txt between the new owner and the new genus Group can be used: connection, one of the owners and the group can be empty. If the owner is empty, it should be ": belong to the group", if the group is empty, ":" Can not be taken.

3) The Chown-r test:test testdir-r parameter is extremely useful for the directory change owner and the group, and you can change all the files in a directory to a new owner or group by adding the-R parameter.

Linux System chown Command parsing

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.