zoukankan      html  css  js  c++  java
  • 特殊权限位:suid、sgid、sticky

    linux系统特殊权限位 suid、sgid、sticky
    suid 使任意用户获得用文件属主相同的权限,sgid使用户获得与文件属组相同的权限(通过sgid获得的权限等同于同一用户组的权限)
    表示方法:
    suid、sgid属于特殊权限位,位于基础权限位的x权限位置,s表示有x权限,S表示无x权限。
    sticky属于特殊权限位,位于基础权限位的x权限位置,t表示有x权限,T表示无x权限。

    [root@ 55test ts]# ll /usr/bin/passwd
    -rwsr-xr-x. 1 root root 27832 Jun 10 2014 /usr/bin/passwd
    [root@ 55test ts]# ll /etc/shadow
    ----------. 1 root root 904 Oct 10 23:39 /etc/shadow
    

      

    设置suid、sgid方法:suid数字权限为4,sgid数字权限为2,sticky数字权限为1

    chmod u+s a.sh      #添加suid
    chmod u-s a.sh      #取消suid
    chmod 4755 a.sh     #添加suid
    chmod 0755 a.sh     #取消suid
    
    chmod g+s a.sh      #添加sgid
    chmod g-s a.sh      #取消sgid
    chmod 2755 a.sh     #添加guid
    chmod 0755 a.sh     #取消guid
    
    chmod 6755 a.sh     #添加suid、sgid
    chmod 0755 a.sh     #取消suid、guid
    
    
    [root@ 55test mm3]# chmod 7755 3.txt     #添加suid、sgid、sticky
    [root@ 55test mm3]# ll 3.txt 
    -rwsr-sr-t. 1 root root 0 Jul 4 2019 3.txt
    [root@ 55test mm3]# chmod a-x 3.txt      #取消ugo的x权限
    [root@ 55test mm3]# ll 3.txt 
    -rwSr-Sr-T. 1 root root 0 Jul 4 2019 3.txt
    [root@ 55test mm3]# chmod u+x 3.txt      #添加用户x权限
    [root@ 55test mm3]# ll 3.txt 
    -rwsr-Sr-T. 1 root root 0 Jul 4 2019 3.txt
    

      

    君子务本,本立而道生
  • 相关阅读:
    PAT 甲级 1027 Colors in Mars
    PAT 甲级 1026 Table Tennis(模拟)
    PAT 甲级 1025 PAT Ranking
    PAT 甲级 1024 Palindromic Number
    PAT 甲级 1023 Have Fun with Numbers
    PAT 甲级 1021 Deepest Root (并查集,树的遍历)
    Java实现 蓝桥杯VIP 算法训练 无权最长链
    Java实现 蓝桥杯VIP 算法训练 无权最长链
    Java实现 蓝桥杯 算法提高 抽卡游戏
    Java实现 蓝桥杯 算法提高 抽卡游戏
  • 原文地址:https://www.cnblogs.com/00huajiang/p/11363370.html
Copyright © 2011-2022 走看看