NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUES | ATTRIBUTES | SEE ALSO
#include <sys/types.h> #include <unistd.h>int setuid(uid_t uid);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
setuid() sets the real and effective user IDs and the saved set-user-ID of the current process to the specified value. The setuid() function is permitted if the specified ID is equal to the real user ID or the effective user ID of the process, or if the effective user ID is that of the super user.
setgid() sets the real and effective group IDs and the saved set-group-ID of the current process to the specified value. The setgid() function is permitted if the specified ID is equal to the real group ID or the effective group ID of the process, or if the effective user ID is that of the super user.
seteuid() and setegid() set the effective user and group IDs of the current process. The effective user ID may be set to the value of the real user ID or the saved set-user-ID (see execve(2POSIX) ); in this way, the effective user ID of a set-user-ID executable may be toggled by switching to the real user ID, then re-enabled by reverting to the set-user-ID value. Similarly, the effective group ID may be set to the value of the real group ID or the saved set-user-ID.
Upon success, these functions return 0 ; otherwise -1 is returned.
If the user is not the super user, or the uid specified is not the real ID these functions return -1 .
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
MT-Level | Async-Signal-Safe |
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUES | ATTRIBUTES | SEE ALSO