Linux基本权限管理

一. 文件基本权限

1.   - 文件类型,第一个字符为-,代表是文件类型(-文件      d目录     | 软链接文件)

2.  总共10个字符,2~10 总共9个字符,每三个字符为一组

     rw-   u所有者的权限

     r--     g所属组的权限

     r--     o其他人的权限

3. r 读     w 写      x执行

4. 上图中所有者为root,权限rw- 

    所属组为root, 权限为r--

    其他 权限为r--

二、 修改权限 chmod命令

chmod [选项] 模式  文件名

选项 -R 递归

模式  [ugoa][+-=][rwx]   [mode=421]

1. chmod u+x  hello.txt

针对hello.txt 文件,给当前用户,增加x可执行权限

2.  chmod g+x,o+x hello.txt

就是对所属组和其他增加写权限

3. 删除刚才增加的权限

命令为 chmod u-x,g-w,o-w hello.txt

4. chmod u=rwx hello.txt

修改当前用户的权限为rwx

5. chomd a=rw hello.txt

给所有人赋予rw权限

三、权限的数字表示

r ----   4

w ----  2

x ---- 1

rwx r-x r-x

7     5    5

如 chmod 755 hello.txt

原文地址:https://www.cnblogs.com/linlf03/p/8098131.html