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
    

      

    君子务本,本立而道生
  • 相关阅读:
    Linux下用wget下载百度网盘资源
    android系统编译记录
    ubuntu 安装JDK & eclipse
    Linux安全攻略-僵尸进程
    smack user登陆
    smack 创建账户
    我的第一个开源App(彩票开奖查询)
    REST简介
    HTTP 状态码
    测试 ScribeFire Blog Editor
  • 原文地址:https://www.cnblogs.com/00huajiang/p/11363370.html
Copyright © 2011-2022 走看看