[英]Is seteuid a system call on Linux?
到目前为止,我在setuid
上阅读的所有文献都以一种暗示它是系统调用的方式讨论了seteuid
。 第2节man
页从不说明函数是否是系统调用,因此seteuid(2)
没有帮助。 如果它不是系统调用,意味着内核不提供功能,那么如何实现“设置有效UID”呢?
第2节手册页是所有的系统调用-这就是第2节是。 第3节手册页都是库调用,这就是第3节的用途。 有关章节列表及其内容,请参阅man(1)( man
本身的手册页):
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g.
man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
您可以通过编写一个小程序并在其上运行strace来轻松验证它是否是系统调用或者是否在libc中定义。 例如,
int main() {
seteuid();
}
gcc -o main main.c
-bash-4.2$ strace ./main 2>&1 | grep set
setresuid(-1, 1, -1) = -1 EPERM (Operation not permitted)
所以在这种情况下,seteuid是在libc中实现的。 请参阅此处以获取实施
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.