Permission division of files, folders, and links in linux


Authorization code and group

When you hit ll

ll 


The arrow points to the permission and owner of this file


At the forefront, take the access folder as an example for analysis.

drwxr-xr-x 

Grouping

d rwx r-x r-x 
将rwx, r-x, r-x 分为三组。
d表示是个目录。
其中rwx表示属于当前用户的权限。
第一个r-x表示当前用户所在组的其它人的权限。
第二个r-x表示不属于这一组的其他人的权限。

The first position:

  • d means directory
  • l means link file
  • -Means it is a file

The second, third and fourth positions are the code names of permissions:

r	读取权限 		数字代号	4
w	写入权限 		数字代号	2
x	执行权限 		数字代号	1
-	没有任何权限 	数字代号	0

So root/current user has rwx, read and write execution rights.
Other members of the current user's group have rx read, no write, and execute power.
Others have the same position as No. 3.


Scope of permissions:

权限的范围:
	u	所有者
	g	和所有者同组的其他人
	o	u和g之外的人
	a	all 所有

How to modify permissions:

这里通过数字或者字母来修改。

# 修改权限
	chmod
	# 1.字母的方式
		chmod +x abc
		chmod -x abc
		
		chmod a+x abc
		chmod a-x abc
		
		chmod g+w abc
		chmod go+wx kkk
		
	# 2.数字的方式
		chmod 777 abc
		chmod 601 abc
		chmod 000 abc

For example, the letter method:

语法:chmod 对应的角色 +/- 文件或者文件夹
chmod a-x abc # 给abc这个文件夹,对所有人去掉可执行的权限
chmod a+x abc # abc文件夹,所有人都有可执行的权限
chmod g+w abc # 对当前用户的所在组的人对abc文件夹有可写的权限
chmod u+x abc # abc文件对当前用户具有可执行的权限
chmod go+w b.md # g表示group,o表示other go有write的权限,对于b.md文件

Note: The permissions are divided by file or folder.
Root has all permissions and can assign corresponding permissions to files.
Use in combination.
The same is true for numbers. The numbers corresponding to the letters are added.

Guess you like

Origin blog.csdn.net/qq_44783283/article/details/109863046