linux - getresuid() 和 setresuid() 有什么作用?

标签 linux unix setuid

函数 getresuid(&arg1,&arg2,&arg3) 和 setresuid(arg1,arg2,arg3) 有什么作用?

如果给出这些函数的真正基本解释就太好了。

最佳答案

来自credentials(7) man page (删节):

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.

这些函数在一次调用中获取并设置所有这三个 UID。与往常一样,请参阅完整的手册页以获取完整的详细信息。

关于linux - getresuid() 和 setresuid() 有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34452939/

相关文章:

macos - 我可以在 Mac 上为 Emacs 安装 WhizzyTeX(Mac OS X 是 unix 环境)吗?

c - 关于setuid的问题

linux - 在 Linux 中仅更改一个线程的 UID/GID

ruby-on-rails - 保持 rake 作业运行

ruby - 如何在 linux (ubuntu) 上更新 ruby​​?

c - fork() 这个图我看不懂

C通过Makefile设置可执行权限

linux - 如何同时使用亚马逊的弹性负载均衡器和自动缩放?

ruby - 对 Chef 变量有疑问,似乎无法让变量发挥作用

linux - Snort 符号链接(symbolic link)解释