1 .\" Copyright (C) 2001 Andries Brouwer (aeb@cwi.nl)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" [should really be seteuid.3]
24 .\" Modified, 27 May 2004, Michael Kerrisk <mtk-manpages@gmx.net>
25 .\" Added notes on capability requirements
27 .TH SETEGID 2 2007-07-26 "Linux" "Linux Programmer's Manual"
29 seteuid, setegid \- set effective user or group ID
31 .B #include <sys/types.h>
33 .B #include <unistd.h>
35 .BI "int seteuid(uid_t " euid );
37 .BI "int setegid(gid_t " egid );
40 Feature Test Macro Requirements for glibc (see
41 .BR feature_test_macros (7)):
47 _BSD_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600
51 sets the effective user ID of the current process.
52 Unprivileged user processes may only set the effective user ID to the
53 real user ID, the effective user ID or the saved set-user-ID.
55 Precisely the same holds for
57 with "group" instead of "user".
60 .\" equals \-1, nothing is changed.
62 On success, zero is returned.
63 On error, \-1 is returned, and
71 The current process is not privileged (Linux: does not have the
73 capability in the case of
77 capability in the case of
83 is not the real user (group) ID, the effective user (group) ID,
84 or the saved set-user-ID (saved set-group-ID).
88 Setting the effective user (group) ID to the
89 saved set-user-ID (saved set-group-ID) is
90 possible since Linux 1.1.37 (1.1.38).
91 On an arbitrary system one should check _POSIX_SAVED_IDS.
93 Under libc4, libc5 and glibc 2.0
96 .BI setreuid(\-1, " euid" )
97 and hence may change the saved set-user-ID.
98 Under glibc2.1 it is equivalent to
99 .BI setresuid(\-1, " euid" ", \-1)"
100 and hence does not change the saved set-user-ID.
101 Similar remarks hold for
108 .BR capabilities (7),