DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

setluid(S)


setluid -- set login user ID

Syntax

cc . . . -lprot

#include  <sys/types.h>
#include  <sys/security.h>
#include  <sys/audit.h>
#include  <prot.h>

int setluid (uid) unsigned short uid;

Description

The setluid routine is used to set the login user ID of the calling process. The login user ID, or LUID, should be set at login time. Only the super user can set the LUID. Once set, the LUID cannot be reset, even by the super user.

Until the LUID is set, the setuid(S) and setgid(S) routines fail. This ensures that the LUID is set before any identity changes in the other (effective and real) user IDs.

The setluid routine is invoked by the login(M) program just prior to the identity changes caused by setuid(S) and setgid(S) calls. It is also used by at(C) and crontab(C) job entries before starting a non-interactive session for a user.

The LUID is an accurate representation of the user who logged into the system and cannot be altered during the session. The LUID is needed because both the effective and real user IDs can be altered by use of setuid(S) or the setuid bits on an executable file, and consequently, at times during a session, do not accurately reflect the login user.

The LUID is inherited by all children of the process. If the LUID was not set before a fork(S), the child would also contain an unset LUID.

Return value

Upon successful completion, the setluid routine returns a value of 0. Otherwise, a value of -1 is returned and errno is set to indicate the appropriate error.

Diagnostics

If one of the following conditions occurs, the setluid routine fails and errno is set to the corresponding value:


[EINVAL]
user ID is out of range.

[EPERM]
The LUID has already been set for this process or some ancestor of this process.

See also

getluid(S), getuid(S), setuid(S), setgid(S), stat(S)

Standards conformance

The setluid routine is an extension of AT&T System V provided by the Santa Cruz Operation.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003