关于 SUID, SGID 和 Sticky

【SUID】

  • Set-user Identification

  • SUID 属性只能运用在可执行文件上,当用户执行该执行文件时,会临时拥有该可执行文件所有者的权限。

  • 示例

walker@qhost:~$ ll /bin/su 
-rwsr-xr-x 1 root root 40128 May 17  2017 /bin/su*

walker@qhost:~$ ll /usr/bin/sudo
-rwsr-xr-x 1 root root 136808 Jul  4  2017 /usr/bin/sudo*

walker@qhost:~$ ll /usr/bin/passwd 
-rwsr-xr-x 1 root root 54256 May 17  2017 /usr/bin/passwd*

walker@qhost:~$ stat --format=%a /usr/bin/passwd
4755


【SGID】

  • Set-group identification

  • SGID 属性可以应用在目录或可执行文件上。当SGID属性应用在目录上时,该目录中所有建立的文件或子目录的拥有组都会是该目录的拥有组。

  • 示例

walker@qhost:~$ ll -H /usr/bin/write 
-rwxr-sr-x 1 root tty 14752 Mar  1  2016 /usr/bin/write*


【Sticky】

扫描二维码关注公众号,回复: 3527538 查看本文章
  • sticky Bit,saved-text bit,粘着位/粘滞位,也被称作防删除位。

  • Sticky 属性只能应用在目录,当目录拥有 Sticky 属性所有在该目录中的文件或子目录无论是什么权限只有文件或子目录所有者和root用户能删除。

  • 示例

walker@qhost:~$ ll -d /tmp
drwxrwxrwt 14 root root 4096 Oct 11 09:53 /tmp/


【相关阅读】


*** walker ***


猜你喜欢

转载自blog.51cto.com/walkerqt/2298546