chmod command explanation {map}

Source: Internet
Author: User

Directive Name: chmod 
Usage rights: All users 
Mode of use: chmod [-CFVR] [--help] [--version] Mode file ... 
Description: Linux/unix's file invocation permissions are divided into three levels: file owners, groups, and others. The use of chmod can be used to control how files are called by others. 
Parameters: 
Mode: Permission set string in the following format: [Ugoa ...] [[+-=][RWXX] ...] [,...], where 
U represents the owner of the file, G means that the owner of the file belongs to the same group (group), and O indicates that the other person, 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 changed, the change action will be displayed 
-F: Do not display an error message if the file permissions cannot be changed 
-V: Show details of permission changes 
-r: The same permissions change for all files in the current directory and subdirectories (that is, they are changed in a recursive manner) 
--HELP: Show Auxiliary Instructions 
--version: Display version 


650) this.width=650; "Width=" 738 "height=" 427 "title=" 10.jpg "style=" Width:701px;height:389px;float:none; "src=" Https://s2.51cto.com/wyfs02/M01/8C/84/wKiom1hucHvA5Af0AADhp3RV8tU441.jpg "alt=" Wkiom1huchva5af0aadhp3rv8tu441.jpg "/>

650) this.width=650; "Width=" 876 "height=" 614 "title=" 11.jpg "style=" Width:699px;height:494px;float:none; "src=" Https://s2.51cto.com/wyfs02/M01/8C/80/wKioL1hucHuTYZ3LAAEeBReMgBU813.jpg "alt=" Wkiol1huchutyz3laaeebremgbu813.jpg "/>

650) this.width=650; "Width=" 903 "height=" 579 "title=" 12.jpg "style=" Width:700px;height:462px;float:none; "src=" Https://s5.51cto.com/wyfs02/M00/8C/80/wKioL1hucHzy6Uy3AAE8Eit7YZY955.jpg "alt=" Wkiol1huchzy6uy3aae8eit7yzy955.jpg "/>

650) this.width=650; "Width=" "height=" 669 "title=" 13.jpg "style=" Width:690px;height:627px;float:none; "src=" Https://s5.51cto.com/wyfs02/M02/8C/84/wKiom1hucH3jOXVPAAE_xOFk71w410.jpg "alt=" Wkiom1huch3joxvpaae_ Xofk71w410.jpg "/>

650) this.width=650; "Width=" 858 "height=" 659 "title=" 14.jpg "style=" Width:716px;height:561px;float:none; "src=" Https://s1.51cto.com/wyfs02/M01/8C/84/wKiom1hucH7jrD2rAAFnl2wJoY0765.jpg "alt=" Wkiom1huch7jrd2raafnl2wjoy0765.jpg "/>

Example: Set the file file1.txt to be read 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 others other than the other are not writable: 
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 
Same effect 
chmod ug=rwx,o=x File 
And 
chmod 771 File 
Same effect 
Using chmod 4755 filename allows this program to have root privileges.

Directive Name: Chown 
Usage rights: Root 

How to use: chmod [-CFHVR] [--help] [--version] user[] 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. 

Put the meter: 

User: New file owner's user idgroup: The user group of the new file owner (group)-C: If the file owner has changed, the change action is not displayed-f: If the owner of the file cannot be changed and does not display the error message-H: only for the link Change, not the one that the link really points to.-V: Displays details of owner changes-R: the same owner change (i.e., one-by-one change) for all files in the current directory and subdirectories--help: Display Auxiliary description--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 is set to user Lamport of the Users group: 
Chmod-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.

--------------------------------------------------------------------------

Files that run the. sh File type:
Test with the file command to see what type of
File xxxx.sh
If it is bourne-again shell script can be sh xxxx.sh or chmod +x xxxx.sh again./xxx.sh
General. Sh Direct add x (Executable property) chmod +x xxx.sh and then./xxx.sh.
chmod is a command that alters the user's permission to have the specified file. R: Read-only, W: Write, X execute. You can also use numbers


chmod command explanation {map}

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.