SETRESUID(3) Library Functions Manual SETRESUID(3)

setresuidset real user ID, effective user ID, and saved set-user-ID


#include <unistd.h>

int setresuid(uid_t ruid, uid_t euid, uid_t suid);

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 , , and , 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 set to indicate the error, and none of the IDs shall be changed.

The setresuid () function shall fail if:

The value of the ruid , euid , or suid argument is invalid or out-of-range.
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(3), getegid(3), geteuid(3), getgid(3), getresgid(3), getresuid(3), getuid(3), setegid(3), seteuid(3), setgid(3), setregid(3), setresgid(3), setreuid(3), setuid(3)

XBD <unistd.h>

First released in Issue 8.

June 14, 2024 posix.fail