微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

setuid vs seteuid功能

setuid和seteuid函数有什么区别.在man page中,两个函数都有类似的描述.

setuid的:

DESCRIPTION

   setuid()  sets  the  effective user ID of the calling process.  If the effective UID of the caller is root,the real UID and saved
   set-user-ID are also set.

个seteuid:

DESCRIPTION

   seteuid()  sets  the  effective user ID of the calling process.  Unprivileged user processes may only set the effective user ID to
   the real user ID,the effective user ID or the saved set-user-ID.

在两个描述中都包含设置调用进程的有效用户ID.那么有什么区别呢
这两个以及这些功能间的功能如何不同.

还有一个疑问是,只使用chmod(chmod u s)
可以为文件设置set user id权限.然后,仅在程序的运行时期间,该进程具有设置为设置的权限
用户身份.除了这些函数之外,这些函数如何将有效的用户标识设置为进程.

最佳答案
man page

   Thus,a set-user-ID-root program wishing to temporarily drop root
   privileges,assume the identity of an unprivileged user,and then
   regain root privileges afterward cannot use setuid().  You can
   accomplish this with seteuid(2).

原文地址:https://www.jb51.cc/linux/440048.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐