setuid(2) CLIX setuid(2)
NAME
setuid - Sets process user and group IDs
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/types.h>
int setuid(
uid_t user_id );
PARAMETERS
user_id Specifies a new user ID.
DESCRIPTION
The setuid() function sets the real, effective, and saved set-user IDs of
the calling process. If the effective user ID of the calling process is
superuser, the real user ID and effective user ID are set to user_id.
EXAMPLES
if (setuid(new_uid) == -1)
perror("Setuid failed");
RETURN VALUES
Upon successful completion, 0 is returned. If setuid() fails, a value of
-1 is returned and errno is set to indicate the error.
ERRORS
The setuid() function fails if either or both of the following are true:
[EPERM] The real user ID of the calling process is not equal to uid and
its effective user ID is not superuser.
[EINVAL] The user_id parameter is not a valid user ID.
RELATED INFORMATION
Functions: exec(2), getpid(2), getpgrp(2), getppid(2), getuid(2),
geteuid(2), getgid(2), getegid(2), intro(2)
2/94 - Intergraph Corporation 1