setresuid — set real user ID, effective user ID, and saved set-user-ID
The setresuid() function shall set the real user ID, effective user ID, and saved set-user-ID of the calling process to the values specified by ruid, euid, and suid, respectively.
If an argument is -1, the corresponding ID shall not be changed.
Only a process with appropriate privileges can set the real user ID, effective user ID, and saved set-user-ID to any valid value.
A non-privileged process can set its real user ID, effective user ID, and saved set-user-ID, each to one of the values that it currently holds in its real user ID, effective user ID, or saved set-user-ID.
The real user ID, effective user ID, and saved set-user-ID can be set to different values in the same call.
Upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and errno set to indicate the error, and none of the IDs shall be changed.
The setresuid() function shall fail if:
- [EINVAL]
- The value of the ruid, euid, or suid argument is invalid or out-of-range.
- [EPERM]
- The calling process does not have appropriate privileges and an attempt was made to change the real user ID, effective user ID, or saved set-user-ID to a value that is not currently present in one of those IDs or an attempt was made to change the real user ID to a value not permitted by the implementation.
None.
None.
None.
None.
exec , getegid , geteuid , getgid , getresgid , getresuid , getuid , setegid , seteuid , setgid , setregid , setresgid , setreuid , setuid
XBD <unistd.h>
First released in Issue 8.
return to top of page