Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 文件权限 #28

Open
xiaozefeng opened this issue Jul 22, 2019 · 2 comments
Open

Linux 文件权限 #28

xiaozefeng opened this issue Jul 22, 2019 · 2 comments

Comments

@xiaozefeng
Copy link
Owner

xiaozefeng commented Jul 22, 2019

drwxr-xr-x 3 mikefeng wheel 4.0K Jun 30 09:50 golang
第一位:
d 目录
- 普通文件
l 符号链接, 实际指向了一个文件
b,c 分别表示区块设备和其他的外围设备,是特殊类型的文件

第 2-10位 3个为一组
第一个3位: 所有者权限
第二个3位: 所有者同一个组的用户的权限
第三个3位: 企业用户的权限

权限字符的含义
r: 读
w: 写
x: 执行
- : 表示不具备 r,w,x 中的某个权限

@xiaozefeng
Copy link
Owner Author

drwxr-xr-x 3 mikefeng wheel 4.0K Jun 30 09:50 golang
mikefeng = 文件所有者
wheel = 用户组

使用 chown 修改文件所有者以及组

chown mikefeng:wheel -R golang

@xiaozefeng
Copy link
Owner Author

使用chmod 修改文件访问权限
chmod 是通过数字修改文件访问权限的

drwxr-xr-x 3 mikefeng wheel 4.0K Jun 30 09:50 golang

一个组中有3位,
r : 4
w: 2
x: 1
- : 0
三位加起来
rwx = 7
r-- = 4
以此类推

所有具体使用
drwxr-xr-x 3 mikefeng wheel 4.0K Jun 30 09:50 golang
比如要设置这个权限
chmod 754 -R golang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant