setuid vs seteuid功能

前端之家收集整理的这篇文章主要介绍了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.f2er.com/linux/440048.html

猜你在找的Linux相关文章