Changing file properties and Permissions

Source: Internet
Author: User

CHGRP: Change the group that the file belongs to

Chown: Changing the file owner

chmod: Features that change file permissions, SUID, SGID, Sbit, and so on

Change the group that belongs to, CHGRP (changes group).

CHGRP [-r] Group name file name

[[email protected] ~]# CHGRP users Install.log (the group that changed the file Install.log is users (the group must already exist)

Change owner, Chown

Chown [-r] Account name file or directory

[[email protected] ~]# Chown bin Install.log (change the owner of the file to the account bin)

[[email protected] ~]# chown root:root install.log (Change the file owner and group to root)

The above command can also be written as Chown Root.root Install.log But since many people like xx.xx when creating usernames, it is recommended to use:

In addition to use chown can also simply change the file belongs to the group Chown. Root Install.log

Change permissions, chmod

There are two ways to change permissions: the use of numbers and the use of symbols for permission changes

The basic rights of the Linux files are nine, respectively, owner/group/others three kinds of identities have their own read/write/execute rights,

With the Install.log as an example, its corresponding permission is-/rw-(owner)/r--(group)/r--(others)

1. Changing permissions in digital mode

In the array mode Change permission R represents 4,w on behalf of 2,x 1, then Install.log original permission is (4+2+0) (4+0+0) (4+0+0) =644

chmod [-r] XYZ file or directory ps:xyz represents the RWX attribute combined with the

Example: Please change the permissions of Install.log to (-rwxr-xr-x)

Answer: chmod 755 Install.log

2. Symbol type Change file permissions

In this way, you, G, and O represent user, group, others, and a represents all

Here we still take Install.log as an example

Set the user's permission to rwx chmod u=rwx Install.log

Set the permissions of user and group to Rwx,other to R-x chmod ug=rwx,o=r-x Install.log

Delete User's X permission chmod u-x Install.log

Add other's x permission chmod o+x Install.log

Add W chmod a+x Install.log to all members

Changing file properties and 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.