附加权限

Set Uid:----->suid 

  附加在所有者的x位上(x位显示为s),适用于可执行文件

  所有用户执行此文件时获取root用户的权限

# 如给chmod设置uid,其他用户就可以用chmod命令来修改文件权限

[root@server0 ~]# ls -l /usr/bin/chmod -rwxr-xr-x. 1 root root 58552 1月 25 2014 /usr/bin/chmod [root@server0 ~]# chmod u+s /usr/bin/chmod [root@server0 ~]# su - lisi 上一次登录:六 11月 10 13:39:24 CST 2018pts/0 上 [lisi@server0 ~]$ ls -l /etc/passwd -rw-r--r--. 1 root root 2185 Nov 10 13:18 /etc/passwd [lisi@server0 ~]$ chmod o+w /etc/passwd [lisi@server0 ~]$ vim /etc/passwd

[root@server0 ~]# ls -l /etc/passwd
-rw-rw-rwx. 1 root root 2230 11月 10 13:54 /etc/passwd

 

Set Gid:----->sgid 

  附加在属组的x位上(x位显示为s),适用于目录,

  该目录下创建的目录具有和属组一样的权限

[root@server0 ~]# ls -ld /home/hr
drwxr-xr-x. 2 root hr 6 11月 10 13:06 /home/hr
[root@server0 ~]# touch /home/hr/file1.txt
[root@server0 ~]# ls -l /home/hr/file1.txt
-rw-r--r--. 1 root root 0 11月 10 13:07 /home/hr/file1.txt
[root@server0 ~]# chmod g+s /home/hr/
[root@server0 ~]# ls -ld /home/hr/
drwxr-sr-x. 3 root hr 49 11月 10 13:09 /home/hr/
[root@server0 ~]# touch /home/hr/file2.txt
[root@server0 ~]# ls -l /home/hr/file2.txt
-rw-r--r--. 1 root hr 0 11月 10 13:07 /home/hr/file2.txt
[root@server0 ~]# mkdir /home/hr/file
[root@server0 ~]# ls -ld /home/hr/file
drwxr-sr-x. 2 root hr 6 11月 10 13:09 /home/hr/file

Sticky:------>粘滞位

  附加在其他用户的x位上(x位显示为t),适用于开放写权限的目录,

  限制用户删除他人文件

  

原文地址:https://www.cnblogs.com/ray-mmss/p/9920744.html