Linux-chmod command

Function: In the Linux command, chmod to modify a file or directory permissions.

Role: You can make a person designated by modifying the permissions to the file readable, writable, run, greatly ensure the security of the data.

Rookie explain: file permissions calling Linux / Unix is ​​divided into three levels: file owner, group, others. Chmod can use so as to control how the file is called by others.

Usage rights  : All users

grammar

chmod [-cfvR] [--help] [--version] mode file...

Parameter Description

mode: permissions string in the following format:

[ugoa...][[+-=][rwxX]...][,...]

among them:

  • u represents the owner of the file, g represents the owner of the file belonging to the same group (group) who, o represents other than human, a represents three both.
  • + Indicates increased authority - indicates remove permissions, = represents a unique set permissions.
  • r represents read, w represents the writing, x represents an executable , X is only when this file is a subdirectory or file has been set through the executable.

Other parameters:

  • -c: If the file permissions have changed indeed, it shows the change action
  • -f: If the file permissions can not be changed and do not display an error message
  • Details show permission to change: -v
  • -R: all the files and subdirectories in the current directory the same change permissions (that is handed back to the way one by one to change)
  • --help: display HELP
  • --version: show the version

Detailed structure chmod command:

Enter in Linux ll, detailed information file / directory specified directory appears article focuses on rights section, part of the figure is under the red box.

Detailed the FIG: Permissions total of 10 characters, the first character is divided into a group, and a nine characters divided into three groups.

The first character in two cases: if it is "d" represents this is a folder, if it is "-" It is on behalf of a file;

2,3,4 characters : these three characters together on behalf of the owner of the file, u can be represented, with four privileges: r: read permission, w: write permission, x: execute permission, -: No permission;

5,6,7 characters : three characters represents the file belongs to a group, can be expressed by g, has four rights: r: read permission, w: write permission, x: execute permission, -: No authority;

9, 10 characters : all other users on behalf of these three characters other than the owner and owning group, o can be represented, with four privileges: r: read permission, w: write permissions, x: execute permission, -: no authority.

Note: In addition to the back of 9 characters u, g, o, and a a, on behalf of all users.

 

Practical operation of verification:

1. start_nodejs.sh stop_nodejs.sh modify the executable permissions

[154.8.159.209:root@xlp117 / var / www / html / Qiantai / nodejs / smsAdapter] # chmod + x start_nodejs.sh stop_nodejs.sh 

before fixing:

 

Modified:

 

 2. start_nodejs.sh stop_nodejs.sh executable permissions before modify and cancel [as] not screenshots

[154.8.159.209:root@xlp117 / var / www / html / Qiantai / nodejs / smsAdapter] # chmod -x start_nodejs.sh stop_nodejs.sh


----------------
Reference link: https: //blog.csdn.net/jerrytomcat/article/details/81744860

Guess you like

Origin www.cnblogs.com/wangzn/p/12581421.html