#include <unistd.h>
int setuid (UID) uid_t UID;
int setruid (RUID) uid_t RUID;
int seteuid (EUID) uid_t EUID;
int setreuid (RUID, EUID) uid_t RUID; uid_t EUID;
The setuid, setruid, seteuid, and setreuid subroutines reset the process user IDs. The following semantics are supported:
The real and effective user ID parameters can have a value of -1. If the value is -1, the actual value for the UID parameter is set to the corresponding current the UID parameter of the process.
UID | Specifies the user ID to set. |
EUID | Specifies the effective user ID to set. |
RUID | Specifies the real user ID to set. |
Upon successful completion, the setuid, seteuid, and setreuid subroutines return a value of 0. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The setuid, seteuid, and setreuid subroutines are unsuccessful if either of the following is true:
EINVAL | The value of the UID or EUID parameter is not valid. |
EPERM | The process does not have the appropriate privileges and the UID and EUID parameters are not equal to either the real or saved user IDs of the process. |
The operating system does not support setuid or setgid shell scripts.
These subroutines are part of Base Operating System (BOS) Runtime.
The getuid or geteuid subroutine, setgid subroutine.
List of Security and Auditing Subroutines and Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.