What do getresuid() and setresuid() do?

孤者浪人 提交于 2019-12-06 06:54:14

问题


What do the functions getresuid(&arg1,&arg2,&arg3) and setresuid(arg1,arg2,arg3) do?

It would be great if a really basic explanation of these functions were given.


回答1:


From the credentials(7) man page (abridged):

On Linux, each process has the following user and group identifiers:

  • Real user ID and real group ID. These IDs determine who owns the process.

  • Effective user ID and effective group ID. These IDs are used by the kernel to determine the permissions that the process will have when accessing shared resources such as message queues, shared memory, and semaphores. On most UNIX systems, these IDs also determine the permissions when accessing files. However, Linux uses the file system IDs for this task.

  • Saved set-user-ID and saved set-group-ID. These IDs are used in set-user-ID and set-group-ID programs to save a copy of the corresponding effective IDs that were set when the program was executed. A set-user-ID program can assume and drop privileges by switching its effective user ID back and forth between the values in its real user ID and saved set-user-ID.

Those functions get and set all three of those UIDs in one call. And as always, see the full man page for complete details.



来源:https://stackoverflow.com/questions/34452939/what-do-getresuid-and-setresuid-do

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!