zoukankan      html  css  js  c++  java
  • acl

    [root@zq ~]# touch /tmp/a.txt
    [root@zq ~]# getfacl /tmp/a.txt #查看权限
    getfacl: Removing leading '/' from absolute path names
    # file: tmp/a.txt
    # owner: root
    # group: root
    user::rw-
    group::r--
    other::r--
    
    扩展ACL
    [root@zq ~]# setfacl -m u:zq:rwx /tmp/a.txt   #u:设置某个用户拥有的权限  -m 设置权限
    [root@zq ~]# getfacl !$
    getfacl /tmp/a.txt
    getfacl: Removing leading '/' from absolute path names
    # file: tmp/a.txt
    # owner: root
    # group: root
    user::rw-
    user:zq:rwx
    group::r--
    mask::rwx
    other::r--
    
    [root@zq ~]# setfacl -m g:zq:rwx /tmp/a.txt 
    [root@zq ~]# getfacl /tmp/a.txt
    getfacl: Removing leading '/' from absolute path names
    # file: tmp/a.txt
    # owner: root
    # group: root
    user::rw-
    user:zq:rwx
    group::r--
    group:zq:rwx
    mask::rwx
    other::r--
    
    
    [zq@zq 桌面]$ ll /tmp/a.txt 
    -rw-r--r--. 1 root root 0 6月  10 14:29 /tmp/a.txt
    [zq@zq 桌面]$ ll /tmp/a.txt 
    -rw-rwxr--+ 1 root root 0 6月  10 14:29 /tmp/a.txt
    
    
    [root@zq ~]# mkdir /tmp/test   
    [root@zq ~]# setfacl -R -m u:zq:rw- /tmp/test/    #设置目录acl权限
    [root@zq ~]# get !$
    get /tmp/test/
    -bash: get: command not found
    [root@zq ~]# getfacl !$
    getfacl /tmp/test/
    getfacl: Removing leading '/' from absolute path names
    # file: tmp/test/
    # owner: root
    # group: root
    user::rwx
    user:zq:rw-
    group::r-x
    mask::rwx
    other::r-x
    
    
    取消acl权限
    [root@zq ~]# setfacl -x u:zq:rw- /tmp/test/
    setfacl: Option -x: 无效的参数 near character 6
    [root@zq ~]# setfacl -x u:zq: /tmp/test/
    [root@zq ~]# getfacl !$
    getfacl /tmp/test/
    getfacl: Removing leading '/' from absolute path names
    # file: tmp/test/
    # owner: root
    # group: root
    user::rwx
    group::r-x
    mask::r-x
    other::r-x
    
    取消所有的权限
    [root@zq ~]# setfacl -b /tmp/a.txt 
    [root@zq ~]# getfacl !$
    getfacl /tmp/a.txt
    getfacl: Removing leading '/' from absolute path names
    # file: tmp/a.txt
    # owner: root
    # group: root
    user::rw-
    group::r--
    other::r--
    
    
    创建一个让root都无法删除的黑客文件
    rhel6 Linux文件系统扩展属性:chattr lsattr
    +a    只能追加内容
    +i     不能被修改
    [root@zq ~]# ll a.txt 
    -rwxrwxrwx. 1 root root 13 6月  10 16:13 a.txt
    [root@zq ~]# lsattr a.txt 
    -------------e- a.txt
    [root@zq ~]# chattr +a a.txt 
    [root@zq ~]# echo aaa >> a.txt 
    [root@zq ~]# cat a.txt 
    sdfadsfadsfa
    aaa
    [root@zq ~]# chattr +i a.txt 
    [root@zq ~]# echo bbbb >> a.txt 
    -bash: a.txt: 权限不够
    [root@zq ~]# lsattr a.txt 
    ----ia-------e- a.txt
    [root@zq ~]# rm -rf a.txt 
    rm: 无法删除"a.txt": 不允许的操作
    要想有删除更改内容的权限必须去掉ia
    [root@zq ~]# chattr -ia a.txt 
    [root@zq ~]# lsattr a.txt 
    -------------e- a.txt
  • 相关阅读:
    2333
    STL string
    后缀自动机的应用
    省选一轮
    等价类计数问题(Polya定理和burnside引理)
    Prufer序列与树的计数(坑)
    分治算法
    生成函数
    莫队算法
    Xamarin 技术解析
  • 原文地址:https://www.cnblogs.com/zq6041/p/6979104.html
Copyright © 2011-2022 走看看