Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
System Callssetreuid(2)


NAME

 setreuid - set real and effective user IDs

SYNOPSIS

 
#include <unistd.h>
int setreuid(uid_t ruid, uid_t euid);

DESCRIPTION

 

The setreuid() function is used to set the real and effective user IDs of the calling process. If ruid is -1, the real user ID is not changed; if euid is -1, the effective user ID is not changed. The real and effective user IDs may be set to different values in the same call.

If the effective user ID of the calling process is super-user, the real user ID and the effective user ID can be set to any legal value.

If the effective user ID of the calling process is not super-user, either the real user ID can be set to the effective user ID, or the effective user ID can either be set to the saved set-user ID from execve() (seeexec(2)) or the real user ID.

In either case, if the real user ID is being changed (that is, if ruid is not -1), or the effective user ID is being changed to a value not equal to the real user ID, the saved set-user ID is set equal to the new effective user ID.

RETURN VALUES

 

Upon successful completion, 0 is returned. Otherwise, -1 is returned, errno is set to indicate the error, and neither of the user IDs will be changed.

ERRORS

 

The setreuid() function will fail if:

EINVAL
The value of ruid or euid is less than 0 or greater than UID_MAX (defined in <limits.h>).
EPERM
The calling process's effective user ID is not the super-user and a change other than changing the real user ID to the effective user ID, or changing the effective user ID to the real user ID or the saved set-user ID, was specified.

USAGE

 

If a set-user-ID process sets its effective user ID to its real user ID, it can still set its effective user ID back to the saved set-user ID.

SEE ALSO

 

exec(2), getuid(2), setregid(2), setuid(2)


SunOS 5.9Go To TopLast Changed 21 Nov 1996

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.