HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)
s
seteuid(2) seteuid(2)
NAME
seteuid(), setegid() - set effective user and group IDs
SYNOPSIS
#include <sys/unistd.h>
int seteuid(uid_t euid);
int setegid(gid_t egid);
DESCRIPTION
To use these functions, compile with the option
-I/usr/include/ep
and link in the libcext library by
specifying
-lcext, for example:
cc -I/usr/include/ep [flag]... cfile[...] -lcext [...]
seteuid()
sets the effective user ID of the calling process, if euid is equal to the current real or saved
user ID, or if the process has appropriate privileges. The real user ID and saved set-user-ID remain
unchanged.
setegid() sets the effective group ID of the calling process, if egid is equal to the current real or saved
group ID, or if the process has appropriate privileges. The real group ID, saved set-group-ID and any sup-
plementary group IDs remain unchanged.
RETURN VALUE
Upon successful completion,
seteuid() and setegid() return 0. Otherwise, they return -1 and set
errno to indicate the error.
ERRORS
seteuid() and setegid() fail if any of the following conditions are encountered:
[EINVAL] euid,oregid, is not a valid user or group ID.
[EPERM] The process does not have appropriate privileges and euid/egid does not match the
real use/group ID or the saved set-user-ID/set-group-ID.
WARNINGS
Users of seteuid() and setegid() should note that the libcext library will not be available in
future releases of HP-UX. However these functions will be available as part of the C library
libc.
AUTHOR
seteuid() and setegid() were developed by HP.
SEE ALSO
exec(2), getegid(2), geteuid(2), getuid(2), setregid(2), setresgid(2), setresuid(2), setreuid(2), setuid(2).
HP-UX 11i Version 2: December 2007 Update − 1 − Hewlett-Packard Company 375