Linux Permissions---"600,644,700,755,711,666,777"--Blog channel-csdn.net

Source: Internet
Author: User

<title>Linux Permissions---"600,644,700,755,711,666,777"--Blog channel-csdn.net</title>chmod Command Explanation

usage rights: all Users

mode of Use:chmod [-CFVR] [--help] [--version] Mode file ...

Description

Linux/unix's file access rights are divided into three levels: file owners, groups, and others. The use of chmod can be used to control how files are accessed by others.

Mode: Permission set string in the following format: [Ugoa ...] [[+-=][RWXX] ...] [,...], where u represents the owner of the file, G indicates that the owner of the file belongs to the same group (group), and O denotes other persons, a means that all three are.

?

+ indicates an increase in permissions,-represents a cancellation permission, = Represents a unique set of permissions.

R is readable, w means writable, x is executable, x means only if the file is a subdirectory, or the file has been set as executable.

?

-c: If the file permissions have indeed been changed, the change action is displayed

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

-V: Show details of permission changes

-r: The same permissions changes (that is, one-by-one) for all files in the current directory and subdirectories

--HELP: Display Auxiliary description

--version: Display version

?

Example:

Set the file file1.txt to be readable by everyone

?

chmod ugo+r File1.txt

?

Set the file file1.txt to be readable by everyone

?

chmod a+r File1.txt

?

The file file1.txt and File2.txt are set as the owner of the file, and the same group as the person to which they belong can be written, but not others

?

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

?

Set ex1.py to only the owner of the file can perform

?

chmod u+x ex1.py

?

Set all files and subdirectories in the current directory to be readable by anyone

?

Chmod-r A+r *

?

In addition chmod can also use numbers to represent permissions such as chmod 777 file

The syntax is:chmod ABC file

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

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=7.

Example:

chmod a=rwx file and chmod 777 file effect are the same

chmod ug=rwx,o=x file and chmod 771 file effect are the same

Use chmod 4755 filename to give the program root privileges

?

? chown Command details

usage rights:root

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

Description

Linux/unix is a multi-person and multi-work system, with all files 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.

?

User: The user of the new file owner

idGROUP: The user base of the new file owner (group)

C: If the file owner has changed, the change action is displayed

-F: Do not display an error message if the owner of the file cannot be changed

-H: Changes to the link only, not the file that the link really points to

-V: Show details of owner changes

-R: Same owner change for all files in the current directory and subdirectories (i.e., one by one in a recursive way)

--HELP: Show Auxiliary Instructions

--version: Display version

?

Example:

Set the owner of the archive file1.txt to the Users group user Jessie

?

Chown Jessie:users File1.txt

?

The owner of all files and subdirectories in the current directory will be the users of the user group Lamport

?

Chown-r Lamport:users *

?

-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

?

SUID's representative number is 4, for example 4755 results are-rwsr-xr-x

Sgid's representative number is 2, for example 6755 results are-rwsr-sr-x

The sticky bit represents a number of 1, for example 7755 results are-rwsr-sr-t



From for notes (Wiz)

Linux Permissions---"600,644,700,755,711,666,777"--Blog channel-csdn.net

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.