#include <sys/types.h> #include <sys/security.h> #include <sys/audit.h> #include <prot.h>
int setluid (uid) unsigned short uid;
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.