seteuid(2) - SerenityOS man pages


seteuid, setegid - set effective user / group ID


#include <unistd.h>

int seteuid(uid_t);
int setegid(gid_t);


Sets the effective user or group ID.

For non-superusers, the effective ID can only be set to the current real or saved ID.

In particular, seteuid(geteuid()) will fail if the current effective user ID is not equal to the current real or saved ID.

Return value

If the call was set successful, returns 0. Otherwise, returns -1 and sets errno to describe the error.


See also