Linux权限管理

  • linux权限

    1. r 读
    2. w 写
    3. x 执行
  • linu用户

    1. 所有者(u)
    2. 所属组(g)
    3. 其他用户(o)
-rw-r--r--. 1 root root  215 Dec  2 20:16 abc.txt

用户、组、权限分配

  1. 用户管理
    useradd rick
    userdel rick
    passwd rick

  2. 用户组
    groupadd xhope
    groupdel xhope
    gpasswd -a rick xhope

  3. 权限分配
    chmod 755 test.java
    chmod g+w test.java
    chmod o-w test.java
    chmod a+w test.java

    acl权限分配

    [root@localhost common]# setfacl -m u:tmpuser:rw test.py
    [tmpuser@localhost common]$ getfacl test.py
    # file: test.py
    # owner: rick
    # group: xhope
    user::r-x
    user:tmpuser:rw-
    group::--x
    mask::rwx
    other::--x
    [root@localhost common]# setfacl -m g:xhope:rw test.py
    [root@localhost common]# setfacl -x u:tmpuser test.py
    [root@localhost common]# setfacl -b test.py
    [root@localhost common]# getfacl test.py
    # file: test.py
    # owner: rick
    # group: xhope
    user::r-x
    group::--x
    other::--x