seteuid - Online Linux Manual PageSection : 2
Updated : 2023-02-05
Source : Linux man-pages 6.03
NAMEseteuid, setegid − set effective user or group ID
LIBRARYStandard C library (libc, −lc)
SYNOPSIS#include <unistd.h>int seteuid(uid_t euid);
int setegid(gid_t egid);Feature Test Macro Requirements for glibc (see feature_test_macros(7)): seteuid(), setegid(): _POSIX_C_SOURCE >= 200112L
|| /* glibc <= 2.19: */ _BSD_SOURCE
DESCRIPTIONseteuid() sets the effective user ID of the calling process. Unprivileged processes may only set the effective user ID to the real user ID, the effective user ID or the saved set-user-ID. Precisely the same holds for setegid() with "group" instead of "user".
RETURN VALUEOn success, zero is returned. On error, −1 is returned, and errno is set to indicate the error. Note: there are cases where seteuid() can fail even when the caller is UID 0; it is a grave security error to omit checking for a failure return from seteuid().
ERRORSEINVAL The target user or group ID is not valid in this user namespace. EPERM In the case of seteuid(): the calling process is not privileged (does not have the CAP_SETUID capability in its user namespace) and euid does not match the current real user ID, current effective user ID, or current saved set-user-ID. In the case of setegid(): the calling process is not privileged (does not have the CAP_SETGID capability in its user namespace) and egid does not match the current real group ID, current effective group ID, or current saved set-group-ID.
STANDARDSPOSIX.1-2001, POSIX.1-2008, 4.3BSD.
NOTESSetting the effective user (group) ID to the saved set-user-ID (saved set-group-ID) is possible since Linux 1.1.37 (1.1.38). On an arbitrary system one should check _POSIX_SAVED_IDS. Under glibc 2.0, seteuid(euid) is equivalent to setreuid(−1, euid) and hence may change the saved set-user-ID. Under glibc 2.1 and later, it is equivalent to setresuid(−1, euid, −1) and hence does not change the saved set-user-ID. Analogous remarks hold for setegid(), with the difference that the change in implementation from setregid(−1, egid) to setresgid(−1, egid, −1) occurred in glibc 2.2 or 2.3 (depending on the hardware architecture). According to POSIX.1, seteuid() (setegid()) need not permit euid (egid) to be the same value as the current effective user (group) ID, and some implementations do not permit this.
C library/kernel differencesOn Linux, seteuid() and setegid() are implemented as library functions that call, respectively, setreuid(2) and setregid(2).
SEE ALSOgeteuid(2), setresuid(2), setreuid(2), setuid(2), capabilities(7), credentials(7), user_namespaces(7) 0
Johanes Gumabo
Data Size : 11,708 byte
man-setegid.2Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 199,564
Visitor ID : :
Visitor IP : 3.14.245.172 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.