LINUX under CHMOD|CHOWN|CHGRP and usage and differences

Source: Internet
Author: User
Tags readable

1, CHGRP (change the file belongs to the user group)

CHGRP user Group filename # # #便是这个格了. If the entire contents are changed, the plus-r parameter is used for recursion.

Example: Chgrp-r user smb.conf

2. Chown (change file owner)

Landscape: A:chown User name files/directories

B:chown User name: User group: File/Catalog

If the entire contents are changed, the plus-r parameter is used for recursion.

Example: Chown-r root/etc/config.cfg

Chown-r Root:root/home

3, chmod (change file attributes)

There are two ways to set file properties, and parting is numbers and tokens.

Mode: Permission to set the string, the pattern is as follows: [Ugoa ...] [[+-=][RWXX] ...] [,...], where u implies that the owner of the file, G implies that the owner of the file belongs to the Group (group), and O implies that the other person, a implies that all three are.

+ hint add permission,-hint to dismiss permission, = imply only set permission.

R implies readable, W implies writable, X implies can be implemented, x implies that only if the file is a subdirectory, presumably the file has been set up for implementation.

-S: The file in which the Master or group ID of the process is placed as the file owner.

C: If the file authority has changed, it will show its change action

-F: Do not display error messages if the file permissions cannot be changed

-V: Specific information on performance of permission changes

-r: All the files under the present catalog and the sub-session of the Change of authority (that is, in a recursive way change)

--HELP: Performance Help statement

--version: Performance version

  Example : Set the file file1.txt to all people can read:

chmod ugo+r File1.txt

Set the file file1.txt to be read by all people:

chmod a+r File1.txt

The file file1.txt and File2.txt are set to the owner of the file, and the person to whom it belongs can be written to, but not to the others:

chmod ug+w,o-w file1.txt File2.txt

The ex1.py is set to only the owner of the file can execute:

chmod u+x ex1.py

Set all files and subdirectories under the present catalog to be readable by anyone:

Chmod-r A+r *

When another user implements Oracle's Sqlplus this French, his identity is temporarily spawned by this French Oracle

chmod u+s Sqlplus

Other, chmod can also use numbers to imply permissions such as chmod 777 file

The syntax is: chmod ABC file

Each of these a,b,c is a number that implies the permissions of user, Group, and other.

R=4,w=2,x=1

To rwx the attribute then 4+2+1=7;

To rw-the attribute then 4+2=6;

To r-x the property, 4+1=5.

  Model :

chmod a=rwx File

And

chmod 777 File

No different results

chmod ug=rwx,o=x File

And

chmod 771 File

No different results

Use chmod 4755 filename to give the program root privileges

If it is the administrator is often said that the root user, on the basis of all the documents can be checked the right.

LINUX under CHMOD|CHOWN|CHGRP and usage and differences

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.