setuid(2) — System Calls
OSF
NAME
setuid − Sets the user ID
SYNOPSIS
#include <sys/types.h> int setuid (
uid_t uid );
PARAMETERS
uidSpecifies the new user ID.
DESCRIPTION
The setuid() function sets the real user ID, effective user ID, and the saved set user ID to the uid parameter.
To change the real user ID, the effective user ID, and the saved set user ID, the calling process must have superuser privilege. If the process does not have appropriate privilege, but the uid parameter is equal to the real user ID or the saved set user ID, the setuid() function sets the effective user ID to the uid parameter; the real user ID and saved set user ID remain unchanged.
NOTES
AES Support Level:
Full use
RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error.
ERRORS
If the setuid() function fails, errno may be set to one of the following values:
[EINVAL]The value of the uid parameter is invalid and not supported by the implementation.
[EPERM]The process does not have superuser privileges, and the uid parameter does not match the real user ID or the saved set user ID.
RELATED INFORMATION
Functions: exec(2), getuid(2), getuid(2), setreuid(2)