setuid(2) System Calls Manual setuid(2) setuid - LIBRARY Standard C library (libc, -lc) #include int setuid(uid_t uid); setuid() . ( CAP_SETUID ), . Linux setuid() POSIX _POSIX_SAVED_IDS. setuid- ( setuid-root) , , . root setuid root, : setuid() , , uid. root. , , root setuid, root , root, setuid(). seteuid(2). On success, zero is returned. On error, -1 is returned, and errno is set to indicate the error. : , setuid() UID 0; -- setuid(). EAGAIN UID (. . uid UID ), . EAGAIN uid UID , ID ruid RLIMIT_NPROC . Linux 3.1 ( ); EAGAIN execve(2). EINVAL , uid, . EPERM (Linux: CAP_SETUID ), uid . C ID . POSIX , . NPTL POSIX , UID GID . ( setuid()) , , , . nptl(7). POSIX.1-2008. POSIX.1-2001, SVr4. Not quite compatible with the 4.4BSD call, which sets all of the real, saved, and effective user IDs. setuid() Linux 16- . Linux 2.4 setuid32(), 32- . glibc setuid() . Linux , . setuid() . . setfsuid(2). uid , core-. . getuid(2), seteuid(2), setfsuid(2), setreuid(2), capabilities(7), credentials(7), user_namespaces(7) Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . setuid(2)