up | Inhaltsverzeichniss | Kommentar

Manual page for SETUID(3)

setuid, setgid - set user and group ID

SYNOPSIS

#include <sys/types.h>

int setuid(uid_t uid);

int setgid(gid_t gid);

(ALSO AVAILABLE IN BSD)

int seteuid(uid_t euid);

int setruid(uid_t ruid);

int setegid(gid_t egid);

int setrgid(gid_t rgid);

DESCRIPTION

Setuid (setgid) sets the real and effective user ID (group ID) and saved set-user-ID (set-group-ID) of the current process to uid (gid) if the calling process is super-user. If the process is not super-user, but uid (gid) is equal to the real user ID or the saved set-user-ID, setuid (setgid) sets the effective user ID to uid (gid).

The BSD routines seteuid, setruid, setegid, and setrgid set either just the effective or just the real user or group ID as above.

RETURN VALUE

Upon successful completion a value of zero is returned. Otherwise a -1 is returned and errno is set to indicate the error.

ERRORS

Setuid and setgid shall return -1 and set errno to the corresponding value:
[EINVAL]
The value of the uid (gid) argument is invalid and not supported by the implementation.
[EPERM]
The process does not have appropriate privileges and uid (gid) does not match the real user ID or the saved set-user-ID.

SEE ALSO

setreuid(2), setregid(2), getuid(2), getgid(2)


index | Inhaltsverzeichniss | Kommentar

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