setreuid(2) System Calls Manual setreuid(2) setreuid, setregid - / LIBRARY Standard C library (libc, -lc) #include int setreuid(uid_t ruid, uid_t euid); int setregid(gid_t rgid, gid_t egid); glibc (. feature_test_macros(7)): setreuid(), setregid(): _XOPEN_SOURCE >= 500 || /* glibc 2.19: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _BSD_SOURCE setreuid() . -1, . , . . (. ., ruid -1) , . setregid() , . On success, zero is returned. On error, -1 is returned, and errno is set to indicate the error. : , setreuid() UID 0; -- setreuid(). EAGAIN UID (. . ruid UID ), . EAGAIN ruid UID , ID ruid RLIMIT_NPROC . Linux 3.1 ( ); EAGAIN execve(2). EINVAL . EPERM (Linux: : CAP_SETUID setreuid() CAP_SETGID setregid()), : 1) (); 2) ; 3) () (). POSIX.1 , Linux . setreuid() , , . setregid() , -- . . POSIX.1 . POSIX.1-2008. POSIX.1-2001, 4.3BSD (first appeared in 4.2BSD). () Linux 1.1.37 (1.1.38). setreuid() setregid() Linux 16- . Linux 2.4 setreuid32() setregid32(), 32- . glibc setreuid() setregid() . C ID . POSIX , . NPTL POSIX , UID GID . ( setreuid() setregid()) , , , . nptl(7). . getgid(2), getuid(2), seteuid(2), setgid(2), setresuid(2), setuid(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 . setreuid(2)