LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1816|回复: 3

请问什么是setuid和setgid权限?

[复制链接]
发表于 2004-10-19 00:19:41 | 显示全部楼层 |阅读模式
到底是什么意思啊?
发表于 2004-10-19 01:53:44 | 显示全部楼层
SUID SGID吗?
当一个程序具有SUID SGID权限,当其他用户(other)执行这个程序,就具有这个程序拥有者(owner)的权限,比如passwd这个可执行文件就具有SUID的权限,它属于root,当一般用户使用passwd的时候,就具有了root的权限,可以写入/etc/shadow(密码存放文件)
查看下这个文件就可以知道一般用户是没有权限去读/写它的
因为SUID,才可以写入数据。
SGID也是一个意思。
发表于 2004-10-19 13:51:31 | 显示全部楼层
The ls utility shows setuid permission as an s in the owner's executable position and setgid as an s in the group's executable position.

When you are running as superuser, you can change the permissions of a file owned by root to setuid.  When an ordinary user executes a file that is owned by root and has setuid permissions, the program has full root privileges.  In other words, this program can do anything that root can do and that the program does or allows the user to do.  The user's privileges do not change.  When the program finishes running, all user privileges are back to the way they were before the program was started.  

Setuid programs that are owned by root are powerful and also dangerous to system security, which is why very few of them are on the system.  As 6692975 mentioned, passwd is just one of such programs.  Because a root-owned setuid program allows someone who does not know the root password to have the powers of superuser, it is a tempting target for a malicious user.  Your site should have as few of these programs as necessary.  You can disable setuid programs at the filesystem level by mounting a filesystem with the nosuid option.
 楼主| 发表于 2004-10-19 19:59:49 | 显示全部楼层
谢谢两位!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表