当前位置: 首页 > Linux

关于SUID、SGID和Sticky(qbit)

时间:2023-04-06 05:27:54 Linux

SUIDSet-userIdentificationSUID属性只能用在可执行文件上。当用户执行该可执行文件时,会暂时拥有该可执行文件的属主权限。示例#查找具有SUIDroot@qhost:/home/walker的文件#sudofind/-perm/4000walker@qhost:~$ll/bin/su-rwsr-xr-x1rootroot40128May172017/bin/su*walker@qhost:~$ll/usr/bin/sudo-rwsr-xr-x1rootroot1368082017年7月4日/usr/bin/sudo*walker@qhost:~$ll/usr/bin/passwd-rwsr-xr-x1rootroot54256May172017/usr/bin/passwd*walker@qhost:~$stat--format=%a/usr/bin/passwd4755SGIDSet-groupidentificationSGID属性可以应用于目录或可执行文件。当SGID属性应用于一个目录时,在该目录下创建的所有文件或子目录的所属组将是该目录的所属组。示例#查找具有SGID的目录或文件root@qhost:/home/walker#sudofind/-perm/2000#directoryroot@qhost:/home/walker#ll-d/var/cache/mandrwxr-sr-x28manroot4096Oct1106:25/var/cache/man/#executablewalker@qhost:~$ll-H/usr/bin/write-rwxr-sr-x1roottty14752Mar12016/usr/bin/write*StickystickyBit,saved-textbit,stickybit/stickybit,又称防删除位。Sticky属性只能应用于目录。当目录具有Sticky属性时,目录下的所有文件或子目录,无论什么权限,只有文件或子目录的所有者和root用户可以删除。Example#Finddirectorieswithstickyroot@qhost:/home/walker#sudofind/-perm/1000walker@qhost:~$ll-d/tmpdrwxrwxrwt14rootroot4096Oct1109:53/tmp/本文来自qbitsnap