In linux, change the folder permission and change the file owner.

Source: Internet
Author: User


In linux, the command chmod is used to change the folder permission and change the folder permission of the file owner. chmod is followed by a letter, followed by a file name (such as chmod a + x) www.2cto.com. When you want to use the chmod command to change the permission, the user identity of the file mainly includes the following types: u (user): users with files (owner); g (group): group where the owner is located; o (other): Others (group not the owner or owner);: everyone or all (u, g, and o ). The user has the following file access permissions: r: read permission; w: write permission; x: Execution permission. The File Permission configuration behaviors include: +: Add permission;-: delete permission; =: Make it the only permission. Therefore, any user of chmod a + x has the execution permission. is chmod followed by a number, followed by the file name to explain, in fact, the form of the entire command is sudo chmod-(representing the type) ××× (owner) ××× (group user) each digit of XXX (other users) represents a permission setting of the user type. The value ranges from 0 ~ 7, that is, the binary [000] ~ [111]. Each digit of the three binary numbers represents the read, write, and execution permissions respectively. For example, "000" indicates that no three permissions are available, and "100" indicates read-only. In this way, we have the following correspondence: 0 [000] No permissions 4 [100] Read-Only permissions 6 [110] Read and Write Permissions 7 [111] Read and Write execution permissions www.2cto.com change the usage of the file owner command chown: chown [Option]... [owner] [: [group] file... or: chown [Option]... -- reference = reference file... purpose: Change the owner of each file and/or its group-c, -- changes is similar to verbose, but the result is displayed only when there is a change -- dereference is affected by the object indicated by the symbolic link, instead of the symbolic link itself-h, -- no-dereference will affect the symbolic link itself, rather than the destination indicated by the symbolic link (when the system supports changing the owner of the symbolic link, this option is useful) -- from = Current Owner: the current group www.2cto.com changes the owner and group only when the owner and group of each file comply with the option. One of these attributes can be omitted. In this case, the omitted attributes do not need to conform to the original attributes. -- No-preserve-root does not treat "/" (default) -- preserve-root does not allow recursive operations on "/"-f, -- silent, -- quiet removes most of the error messages -- reference = use the reference file's group instead of the specified value-R, -- recursive recursively processes all files and subdirectories-v, -- verbose displays diagnostic information for all processed files

Related Article

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.