SETREUID(2) System Calls Manual SETREUID(2)NAME
setreuid - set real and effective user ID's
int ruid, euid;
The real and effective user ID's of the current process are set according to the arguments. If ruid or euid is -1, the current uid is
filled in by the system. Unprivileged users may change the real user ID to the effective user ID and vice-versa; only the super-user may
make other changes.
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
[EPERM] The current process is not the super-user and a change other than changing the effective user-id to the real user-id was
SEE ALSO getuid(2), setregid(2), setuid(3)4th Berkeley Distribution May 9, 1985 SETREUID(2)
Check Out this Related Man Page
SETREUID(2) Linux Programmer's Manual SETREUID(2)NAME
setreuid, setregid - set real and/or effective user or group ID
int setreuid(uid_t ruid, uid_t euid);
int setregid(gid_t rgid, gid_t egid);
setreuid sets real and effective user IDs of the current process. Unprivileged users may only set the real user ID to the real user ID or
the effective user ID, and may only set the effective user ID to the real user ID, the effective user ID or the saved user ID.
Supplying a value of -1 for either the real or effective user ID forces the system to leave that ID unchanged.
If the real user ID is set or the effective user ID is set to a value not equal to the previous real user ID, the saved user ID will be set
to the new effective user ID.
Completely analogously, setregid sets real and effective group ID's of the current process, and all of the above holds with "group" instead
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
EPERM The current process is not the super-user and changes other than (i) swapping the effective user (group) ID with the real user
(group) ID, or (ii) setting one to the value of the other or (iii) setting the effective user (group) ID to the value of the saved
user (group) ID was specified.
Setting the effective user (group) ID to the saved user ID is possible since Linux 1.1.37 (1.1.38).
BSD 4.3 (the setreuid and setregid function calls first appeared in 4.2BSD).
SEE ALSO getuid(2), getgid(2), setuid(2), setgid(2), seteuid(2), setresuid(2)Linux 1.1.38 1994-08-02 SETREUID(2)
I wrote a C program (runas.c) that runs a command as a different user.
The problem I'm having is that the new user's group membership isn't going into
effect. Take the following scenario:
I login as "kirk". I need to run some commands as "spock". kirk and spock belong
to these... (4 Replies)
I have read just about every rpcbind not starting thread and article on the internet it seems, but I have not found a solution to my problem as of yet. I have a solaris 10 server that has been running with no problems for a while. The other day it crashed and would not boot to the gui... (2 Replies)