SETLUID(S) UNIX System V SETLUID(S)
Name
setluid - set login user ID
Syntax
#include <sys/types.h>
#include <sys/security.h>
#include <sys/audit.h>
#include <prot.h>
int setluid (uid)
unsigned short uid;
Description
Setluid is used to set the login user ID of the calling
process. The login UID, or LUID, should be set at login
time. Only the superuser can set the LUID. Once set, it
cannot be reset, even by the superuser.
Until the LUID is set, the setuid(S) and setgid(S) system
calls will fail. This ensures that the LUID is set before
any identity changes in the other IDs.
The setluid call is expected to be invoked by the login(C)
program just prior to the identity changes caused by
setuid(S) and setgid(S) calls. It is also expected to be
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 UIDs can be altered by use of setuid(S) and the setuid
bits on an executable file, and at times during a session,
will not accurately reflect the login user.
The LUID is inherited by all children of the process. If
the LUID were not set before a fork(S), the child would also
contain an unset LUID.
Setluid will fail if one or more of the following are true:
[EPERM] The LUID has already been set for this process or
any ancestors of this process.
[EINVAL] Uid is out of range.
Return Value
Upon successful completion a value of 0 is returned.
Otherwise, a value of -1 is returned and errno is set to
indicate the error.
See Also
getluid(S), getuid(S), setuid(S), setgid(S), stat(S)
Value Added
setluid is an extension of AT&T System V provided by the
Santa Cruz Operation.
(printed 6/20/89)