up | Inhaltsverzeichniss | Kommentar

Manual page for SETUID(3V)

setuid, seteuid, setruid, setgid, setegid, setrgid - set user and group ID

SYNOPSIS

#include <sys/types.h>

int setuid(uid)
uid_t uid;

int seteuid(euid)
uid_t euid;

int setruid(ruid)
uid_t ruid;

int setgid(gid)
gid_t gid;

int setegid(egid)
gid_t egid;

int setrgid(rgid)
gid_t rgid;

DESCRIPTION

setuid() (setgid()) sets both the real and effective user ID (group ID) of the current process as specified by uid (gid) (see NOTES).

seteuid() (setegid()) sets the effective user ID (group ID) of the current process.

setruid() (setrgid()) sets the real user ID (group ID) of the current process.

These calls are only permitted to the super-user or if the argument is the real or effective user (group) ID of the calling process.

SYSTEM V DESCRIPTION

If the effective user ID of the calling process is not super-user, but if its real user (group) ID is equal to uid (gid), or if the saved set-user (group) ID from execve.2v is equal to uid (gid), then the effective user (group) ID is set to uid (gid).

RETURN VALUES

These functions return:

0
on success.
-1
on failure and set errno to indicate the error as for setreuid.2 (.Hr -url ../html2/setregid.2.html setregid(2)).

ERRORS

EINVAL
The value of uid (gid) is invalid (less than 0 or greater than 65535).
EPERM
The process does not have super-user privileges and uid (gid) does not matches neither the real user (group) ID of the process nor the saved set-user-ID (set-group-ID) of the process.

SEE ALSO

execve.2v getgid.2v getuid.2v setregid.2 setreuid.2

NOTES

For setuid() to behave as described above, {_POSIX_SAVED_IDS} must be in effect (see sysconf.2v {_POSIX_SAVED_IDS} is always in effect on SunOS systems, but for portability, applications should call sysconf() to determine whether {_POSIX_SAVED_IDS} is in effect for the current system.


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97