1、SUID
通俗的理解为其他用户执行这个程序的时候可以用该程序所有者/组的权限。由于SUID和SGID是在执行程序(程序的可执行位被设置)时起作用,而可执行位只对普通文件和目录文件有意义,所以设置其他种类文件的SUID和SGID位是没有多大意义的。一个文件设置了SUID那么该文件的属性中有s标志,如下所示。
[root@VM_0_11_centos ~]# chmod u+s test
[root@VM_0_11_centos ~]# ls -la test
-rwSr--r-- 1 root root 0 Jan 9 08:04 test
[root@VM_0_11_centos ~]#
使用chmod u+/-s为文件增加或者删除s权限
[root@VM_0_11_centos ~]# chmod u-s /bin/ls
[root@VM_0_11_centos ~]# ls -la /bin/ls
-rwxr-xr-x 1 root root 117608 Aug 20 00:25 /bin/ls
[root@VM_0_11_centos ~]#
2、列出SUID文件
[root@VM_0_11_centos ~]# find / -perm -u=s -type f 2>/dev/null
/usr/lib/polkit-1/polkit-agent-helper-1
/usr/bin/pkexec
/usr/bin/mount
/usr/bin/passwd
/usr/bin/umount
/usr/bin/newgrp
/usr/bin/chsh
/usr/bin/crontab
/usr/bin/at
/usr/bin/s