| LOGIN(1) | General Commands Manual | LOGIN(1) |
NAME
login — log into
the computer
SYNOPSIS
login |
[-fp] [-h
hostname] [user] |
DESCRIPTION
The login utility authenticates a user and
starts a session for them on the current terminal.
getty(8) runs it once a name has been
typed; it is not normally run by hand.
Without a user,
login prompts for one. Authentication and account
checks go through PAM, using the “login” policy in
/etc/pam.d/login; see
pam.conf(5). After a failed
attempt, login says “Login incorrect”
and asks again. Past login-backoff failures it waits
five seconds longer before each new attempt, and after
login-retries failures it exits. A login that is not
finished within login-timeout seconds is abandoned.
The three values come from the “default” class in
login.conf(5).
A user whose password has passed its change time is made to choose a new one before the session starts.
On success, login applies the user's login
class (resource limits, priority, umask and environment), changes the
terminal's owner to the user, records the session in
/var/run/utmpx and
/var/log/wtmpx, and runs the user's shell as a login
shell in the home directory. Unless the class sets
hushlogin or ~/.hushlogin
exists, it first prints the message of the day.
login waits for the shell to exit, then
closes the PAM session, records the logout and gives the terminal back to
root.
The options are as follows:
-f- The user has already been authenticated; skip authentication.
-hhostname- The session comes from hostname.
-p- Keep the environment rather than starting from an empty one.
Only the superuser may run login.
ENVIRONMENT
The shell starts with HOME,
SHELL, USER,
LOGNAME, PATH,
TERM and MAIL set, plus
whatever the login class and the PAM modules add.
FILES
- /etc/login.conf
- login classes
- /etc/motd
- message of the day
- /etc/nologin
- refuses logins other than root's while it exists
- /etc/pam.d/login
- the PAM policy
- /var/run/utmpx
- current sessions
- /var/log/wtmpx
- session history
SEE ALSO
passwd(1), utmpx(3), login.conf(5), pam.conf(5), passwd(5), getty(8)
HISTORY
A login utility appeared in
Version 1 AT&T UNIX. This implementation
was written for OxideBSD.
| September 26, 2026 | OxideBSD |