1LOGIN(1)                         User Commands                        LOGIN(1)
2
3
4

NAME

6       login - begin session on the system
7

SYNOPSIS

9       login [-p] [-h host] [-H] [-f username|username]
10

DESCRIPTION

12       login is used when signing onto a system. If no argument is given,
13       login prompts for the username.
14
15       The user is then prompted for a password, where appropriate. Echoing is
16       disabled to prevent revealing the password. Only a number of password
17       failures are permitted before login exits and the communications link
18       is severed. See LOGIN_RETRIES in CONFIG FILE ITEMS section.
19
20       If password aging has been enabled for the account, the user may be
21       prompted for a new password before proceeding. In such case old
22       password must be provided and the new password entered before
23       continuing. Please refer to passwd(1) for more information.
24
25       The user and group ID will be set according to their values in the
26       /etc/passwd file. There is one exception if the user ID is zero. In
27       this case, only the primary group ID of the account is set. This should
28       allow the system administrator to login even in case of network
29       problems. The environment variable values for $HOME, $USER, $SHELL,
30       $PATH, $LOGNAME, and $MAIL are set according to the appropriate fields
31       in the password entry. $PATH defaults to /usr/local/bin:/bin:/usr/bin
32       for normal users, and to
33       /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin for root,
34       if not otherwise configured.
35
36       The environment variable $TERM will be preserved, if it exists, else it
37       will be initialized to the terminal type on your tty. Other environment
38       variables are preserved if the -p option is given.
39
40       Then the user’s shell is started. If no shell is specified for the user
41       in /etc/passwd, then /bin/sh is used. If there is no home directory
42       specified in /etc/passwd, then / is used, followed by .hushlogin check
43       as described below.
44
45       If the file .hushlogin exists, then a "quiet" login is performed. This
46       disables the checking of mail and the printing of the last login time
47       and message of the day. Otherwise, if /var/log/lastlog exists, the last
48       login time is printed, and the current login is recorded.
49

OPTIONS

51       -p
52           Used by getty(8) to tell login to preserve the environment.
53
54       -f
55           Used to skip a login authentication. This option is usually used by
56           the getty(8) autologin feature.
57
58       -h
59           Used by other servers (such as telnetd(8) to pass the name of the
60           remote host to login so that it can be placed in utmp and wtmp.
61           Only the superuser is allowed use this option.
62
63           Note that the -h option has an impact on the PAM service name. The
64           standard service name is login, but with the -h option, the name is
65           remote. It is necessary to create proper PAM config files (for
66           example, /etc/pam.d/login and /etc/pam.d/remote).
67
68       -H
69           Used by other servers (for example, telnetd(8)) to tell login that
70           printing the hostname should be suppressed in the login: prompt.
71           See also LOGIN_PLAIN_PROMPT below.
72
73       --help
74           Display help text and exit.
75
76       -V, --version
77           Display version information and exit.
78

CONFIG FILE ITEMS

80       login reads the /etc/login.defs configuration file (see login.defs(5)).
81       Note that the configuration file could be distributed with another
82       package (usually shadow-utils). The following configuration items are
83       relevant for login:
84
85       MOTD_FILE (string)
86           Specifies a ":" delimited list of "message of the day" files and
87           directories to be displayed upon login. If the specified path is a
88           directory then displays all files with .motd file extension in
89           version-sort order from the directory.
90
91           The default value is /usr/share/misc/motd:/run/motd:/etc/motd. If
92           the MOTD_FILE item is empty or a quiet login is enabled, then the
93           message of the day is not displayed. Note that the same
94           functionality is also provided by the pam_motd(8) PAM module.
95
96           The directories in the MOTD_FILE are supported since version 2.36.
97
98           Note that login does not implement any filenames overriding
99           behavior like pam_motd (see also MOTD_FIRSTONLY), but all content
100           from all files is displayed. It is recommended to keep extra logic
101           in content generators and use /run/motd.d rather than rely on
102           overriding behavior hardcoded in system tools.
103
104       MOTD_FIRSTONLY (boolean)
105           Forces login to stop display content specified by MOTD_FILE after
106           the first accessible item in the list. Note that a directory is one
107           item in this case. This option allows login semantics to be
108           configured to be more compatible with pam_motd. The default value
109           is no.
110
111       LOGIN_PLAIN_PROMPT (boolean)
112           Tell login that printing the hostname should be suppressed in the
113           login: prompt. This is an alternative to the -H command line
114           option. The default value is no.
115
116       LOGIN_TIMEOUT (number)
117           Maximum time in seconds for login. The default value is 60.
118
119       LOGIN_RETRIES (number)
120           Maximum number of login retries in case of a bad password. The
121           default value is 3.
122
123       LOGIN_KEEP_USERNAME (boolean)
124           Tell login to only re-prompt for the password if authentication
125           failed, but the username is valid. The default value is no.
126
127       FAIL_DELAY (number)
128           Delay in seconds before being allowed another three tries after a
129           login failure. The default value is 5.
130
131       TTYPERM (string)
132           The terminal permissions. The default value is 0600 or 0620 if tty
133           group is used.
134
135       TTYGROUP (string)
136           The login tty will be owned by the TTYGROUP. The default value is
137           tty. If the TTYGROUP does not exist, then the ownership of the
138           terminal is set to the user’s primary group.
139
140           The TTYGROUP can be either the name of a group or a numeric group
141           identifier.
142
143       HUSHLOGIN_FILE (string)
144           If defined, this file can inhibit all the usual chatter during the
145           login sequence. If a full pathname (for example, /etc/hushlogins)
146           is specified, then hushed mode will be enabled if the user’s name
147           or shell are found in the file. If this global hush login file is
148           empty then the hushed mode will be enabled for all users.
149
150           If a full pathname is not specified, then hushed mode will be
151           enabled if the file exists in the user’s home directory.
152
153           The default is to check /etc/hushlogins and if it does not exist
154           then ~/.hushlogin.
155
156           If the HUSHLOGIN_FILE item is empty, then all the checks are
157           disabled.
158
159       DEFAULT_HOME (boolean)
160           Indicate if login is allowed if we cannot change directory to the
161           home directory. If set to yes, the user will login in the root (/)
162           directory if it is not possible to change directory to their home.
163           The default value is yes.
164
165       LASTLOG_UID_MAX (unsigned number)
166           Highest user ID number for which the lastlog entries should be
167           updated. As higher user IDs are usually tracked by remote user
168           identity and authentication services there is no need to create a
169           huge sparse lastlog file for them. No LASTLOG_UID_MAX option
170           present in the configuration means that there is no user ID limit
171           for writing lastlog entries. The default value is ULONG_MAX.
172
173       LOG_UNKFAIL_ENAB (boolean)
174           Enable display of unknown usernames when login failures are
175           recorded. The default value is no.
176
177           Note that logging unknown usernames may be a security issue if a
178           user enters their password instead of their login name.
179
180       ENV_PATH (string)
181           If set, it will be used to define the PATH environment variable
182           when a regular user logs in. The default value is
183           /usr/local/bin:/bin:/usr/bin.
184
185       ENV_ROOTPATH (string), ENV_SUPATH (string)
186           If set, it will be used to define the PATH environment variable
187           when the superuser logs in. ENV_ROOTPATH takes precedence. The
188           default value is
189           /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin.
190

FILES

192       /var/run/utmp, /var/log/wtmp, /var/log/lastlog, /var/spool/mail/*,
193       /etc/motd, /etc/passwd, /etc/nologin, /etc/pam.d/login,
194       /etc/pam.d/remote, /etc/hushlogins, $HOME/.hushlogin
195

BUGS

197       The undocumented BSD -r option is not supported. This may be required
198       by some rlogind(8) programs.
199
200       A recursive login, as used to be possible in the good old days, no
201       longer works; for most purposes su(1) is a satisfactory substitute.
202       Indeed, for security reasons, login does a vhangup(2) system call to
203       remove any possible listening processes on the tty. This is to avoid
204       password sniffing. If one uses the command login, then the surrounding
205       shell gets killed by vhangup(2) because it’s no longer the true owner
206       of the tty. This can be avoided by using exec login in a top-level
207       shell or xterm.
208

AUTHORS

210       Derived from BSD login 5.40 (5/9/89) by Michael Glad <glad@daimi.dk>
211       for HP-UX. Ported to Linux 0.12: Peter Orbaek <poe@daimi.aau.dk>.
212       Rewritten to a PAM-only version by Karel Zak <kzak@redhat.com>
213

SEE ALSO

215       mail(1), passwd(1), passwd(5), utmp(5), environ(7), getty(8), init(8),
216       lastlog(8), shutdown(8)
217

REPORTING BUGS

219       For bug reports, use the issue tracker at
220       https://github.com/karelzak/util-linux/issues.
221

AVAILABILITY

223       The login command is part of the util-linux package which can be
224       downloaded from Linux Kernel Archive
225       <https://www.kernel.org/pub/linux/utils/util-linux/>.
226
227
228
229util-linux 2.37.2                 2021-06-02                          LOGIN(1)
Impressum