]> git.ipfire.org Git - thirdparty/util-linux.git/blob - login-utils/login.1.adoc
login: (adoc) add hint about PAM and env.variables
[thirdparty/util-linux.git] / login-utils / login.1.adoc
1 //po4a: entry man manual
2 ////
3 Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
4 May be distributed under the GNU General Public License
5 ////
6 = login(1)
7 :doctype: manpage
8 :man manual: User Commands
9 :man source: util-linux {release-version}
10 :page-layout: base
11 :command: login
12
13 == NAME
14
15 login - begin session on the system
16
17 == SYNOPSIS
18
19 *login* [*-p*] [*-h* _host_] [*-H*] [*-f* _username_|_username_]
20
21 == DESCRIPTION
22
23 *login* is used when signing onto a system. If no argument is given, *login* prompts for the username.
24
25 The user is then prompted for a password, where appropriate. Echoing is disabled to prevent revealing the password. Only a number of password failures are permitted before *login* exits and the communications link is severed. See *LOGIN_RETRIES* in the *CONFIG FILE ITEMS* section.
26
27 If password aging has been enabled for the account, the user may be prompted for a new password before proceeding. In such case old password must be provided and the new password entered before continuing. Please refer to *passwd*(1) for more information.
28
29 The user and group ID will be set according to their values in the _/etc/passwd_ file. There is one exception if the user ID is zero. In this case, only the primary group ID of the account is set. This should allow the system administrator to login even in case of network problems. The environment variable values for *$HOME*, *$USER*, *$SHELL*, *$PATH*, *$LOGNAME*, and *$MAIL* are set according to the appropriate fields in the password entry. *$PATH* defaults to _/usr/local/bin:/bin:/usr/bin_ for normal users, and to _/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin_ for root, if not otherwise configured.
30
31 The environment variable *$TERM* will be preserved, if it exists, else it will be initialized to the terminal type on your tty. Other environment variables are preserved if the *-p* option is given.
32
33 The environment variables defined by PAM are always preserved.
34
35 Then the user's shell is started. If no shell is specified for the user in _/etc/passwd_, then _/bin/sh_ is used. If there is no home directory specified in _/etc/passwd_, then _/_ is used, followed by _.hushlogin_ check as described below.
36
37 If the file _.hushlogin_ exists, then a "quiet" login is performed. This disables the checking of mail and the printing of the last login time and message of the day. Otherwise, if _/var/log/lastlog_ exists, the last login time is printed, and the current login is recorded.
38
39 == OPTIONS
40
41 *-p*::
42 Used by *getty*(8) to tell *login* to preserve the environment.
43
44 *-f*::
45 Used to skip a login authentication. This option is usually used by the *getty*(8) autologin feature.
46
47 *-h*::
48 Used by other servers (such as *telnetd*(8) to pass the name of the remote host to *login* so that it can be placed in utmp and wtmp. Only the superuser is allowed use this option.
49 +
50 Note that the *-h* option has an impact on the *PAM service* *name*. The standard service name is _login_, but with the *-h* option, the name is _remote_. It is necessary to create proper PAM config files (for example, _/etc/pam.d/login_ and _/etc/pam.d/remote_).
51
52 *-H*::
53 Used by other servers (for example, *telnetd*(8)) to tell *login* that printing the hostname should be suppressed in the login: prompt. See also *LOGIN_PLAIN_PROMPT* below.
54
55 *--help*::
56 Display help text and exit.
57
58 *-V*, *--version*::
59 Display version information and exit.
60
61 == CONFIG FILE ITEMS
62
63 *login* reads the _/etc/login.defs_ configuration file (see login.defs(5)). Note that the configuration file could be distributed with another package (usually shadow-utils). The following configuration items are relevant for *login*:
64
65 *MOTD_FILE* (string)::
66 Specifies a ":" delimited list of "message of the day" files and directories to be displayed upon login. If the specified path is a directory then displays all files with .motd file extension in version-sort order from the directory.
67 +
68 The default value is _/usr/share/misc/motd:/run/motd:/etc/motd_. If the *MOTD_FILE* item is empty or a quiet login is enabled, then the message of the day is not displayed. Note that the same functionality is also provided by the *pam_motd*(8) PAM module.
69 +
70 The directories in the *MOTD_FILE* are supported since version 2.36.
71 +
72 Note that *login* does not implement any filenames overriding behavior like pam_motd (see also *MOTD_FIRSTONLY*), but all content from all files is displayed. It is recommended to keep extra logic in content generators and use _/run/motd.d_ rather than rely on overriding behavior hardcoded in system tools.
73
74 *MOTD_FIRSTONLY* (boolean)::
75
76 Forces *login* to stop display content specified by *MOTD_FILE* after the first accessible item in the list. Note that a directory is one item in this case. This option allows *login* semantics to be configured to be more compatible with pam_motd. The default value is _no_.
77
78 *LOGIN_PLAIN_PROMPT* (boolean)::
79
80 Tell *login* that printing the hostname should be suppressed in the login: prompt. This is an alternative to the *-H* command line option. The default value is _no_.
81
82 *LOGIN_TIMEOUT* (number)::
83
84 Maximum time in seconds for login. The default value is _60_.
85
86 *LOGIN_RETRIES* (number)::
87
88 Maximum number of login retries in case of a bad password. The default value is _3_.
89
90 *LOGIN_KEEP_USERNAME* (boolean)::
91
92 Tell *login* to only re-prompt for the password if authentication failed, but the username is valid. The default value is _no_.
93
94 *FAIL_DELAY* (number)::
95
96 Delay in seconds before being allowed another three tries after a login failure. The default value is _5_.
97
98 *TTYPERM* (string)::
99
100 The terminal permissions. The default value is _0600_ or _0620_ if tty group is used.
101
102 *TTYGROUP* (string)::
103
104 The login tty will be owned by the *TTYGROUP*. The default value is _tty_. If the *TTYGROUP* does not exist, then the ownership of the terminal is set to the user's primary group.
105 +
106 The *TTYGROUP* can be either the name of a group or a numeric group identifier.
107
108 *HUSHLOGIN_FILE* (string)::
109
110 If defined, this file can inhibit all the usual chatter during the login sequence. If a full pathname (for example, _/etc/hushlogins_) is specified, then hushed mode will be enabled if the user's name or shell are found in the file. If this global hush login file is empty then the hushed mode will be enabled for all users.
111 +
112 If a full pathname is not specified, then hushed mode will be enabled if the file exists in the user's home directory.
113 +
114 The default is to check _/etc/hushlogins_ and if it does not exist then _~/.hushlogin_.
115 +
116 If the *HUSHLOGIN_FILE* item is empty, then all the checks are disabled.
117
118 *DEFAULT_HOME* (boolean)::
119
120 Indicate if login is allowed if we cannot change directory to the home directory. If set to _yes_, the user will login in the root (/) directory if it is not possible to change directory to their home. The default value is _yes_.
121
122 *LASTLOG_UID_MAX* (unsigned number)::
123
124 Highest user ID number for which the _lastlog_ entries should be updated. As higher user IDs are usually tracked by remote user identity and authentication services there is no need to create a huge sparse _lastlog_ file for them. No LASTLOG_UID_MAX option present in the configuration means that there is no user ID limit for writing _lastlog_ entries. The default value is _ULONG_MAX_.
125
126 *LOG_UNKFAIL_ENAB* (boolean)::
127
128 Enable display of unknown usernames when login failures are recorded. The default value is _no_.
129 +
130 Note that logging unknown usernames may be a security issue if a user enters their password instead of their login name.
131
132 *ENV_PATH* (string)::
133
134 If set, it will be used to define the *PATH* environment variable when a regular user logs in. The default value is _/usr/local/bin:/bin:/usr/bin_.
135
136 *ENV_ROOTPATH* (string)::
137 *ENV_SUPATH* (string)::
138
139 If set, it will be used to define the PATH environment variable when the superuser logs in. *ENV_ROOTPATH* takes precedence. The default value is _/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin_.
140
141 == FILES
142
143 _/var/run/utmp_,
144 _/var/log/wtmp_,
145 _/var/log/lastlog_,
146 _/var/spool/mail/*_,
147 _/etc/motd_,
148 _/etc/passwd_,
149 _/etc/nologin_,
150 _/etc/pam.d/login_,
151 _/etc/pam.d/remote_,
152 _/etc/hushlogins_,
153 _$HOME/.hushlogin_
154
155 == BUGS
156
157 The undocumented BSD *-r* option is not supported. This may be required by some *rlogind*(8) programs.
158
159 A recursive login, as used to be possible in the good old days, no longer works; for most purposes *su*(1) is a satisfactory substitute. Indeed, for security reasons, *login* does a *vhangup*(2) system call to remove any possible listening processes on the tty. This is to avoid password sniffing. If one uses the command *login*, then the surrounding shell gets killed by *vhangup*(2) because it's no longer the true owner of the tty. This can be avoided by using *exec login* in a top-level shell or xterm.
160
161 == AUTHORS
162
163 Derived from BSD login 5.40 (5/9/89) by mailto:glad@daimi.dk[Michael Glad] for HP-UX. Ported to Linux 0.12: mailto:poe@daimi.aau.dk[Peter Orbaek]. Rewritten to a PAM-only version by mailto:kzak@redhat.com[Karel Zak]
164
165 == SEE ALSO
166
167 *mail*(1),
168 *passwd*(1),
169 *passwd*(5),
170 *utmp*(5),
171 *environ*(7),
172 *getty*(8),
173 *init*(8),
174 *lastlog*(8),
175 *shutdown*(8)
176
177 include::man-common/bugreports.adoc[]
178
179 include::man-common/footer.adoc[]
180
181 ifdef::translation[]
182 include::man-common/translation.adoc[]
183 endif::[]