]> git.ipfire.org Git - thirdparty/util-linux.git/blob - login-utils/login.1
Merge branch 'fix-exit-codes' of https://github.com/rudimeier/util-linux
[thirdparty/util-linux.git] / login-utils / login.1
1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\" May be distributed under the GNU General Public License
3 .TH LOGIN "1" "June 2012" "util-linux" "User Commands"
4 .SH NAME
5 login \- begin session on the system
6 .SH SYNOPSIS
7 .B login
8 [
9 .BR \-p
10 ] [
11 .BR \-h
12 .IR host
13 ] [
14 .BR \-H
15 ] [
16 .BR \-f
17 .IR username
18 |
19 .IR username
20 ]
21 .SH DESCRIPTION
22 .B login
23 is used when signing onto a system. If no argument is given,
24 .B login
25 prompts for the username.
26 .PP
27 The user is then prompted for a password, where appropriate. Echoing
28 is disabled to prevent revealing the password. Only a small number
29 of password failures are permitted before
30 .B login
31 exits and the communications link is severed.
32 .PP
33 If password aging has been enabled for the account, the user may be
34 prompted for a new password before proceeding. He will be forced to
35 provide his old password and the new password before continuing.
36 Please refer to
37 .BR passwd (1)
38 for more information.
39 .PP
40 The user and group ID will be set according to their values in the
41 .I /etc/passwd
42 file. There is one exception if the user ID is zero: in this case,
43 only the primary group ID of the account is set. This should allow
44 the system administrator to login even in case of network problems.
45 The value for
46 .BR $HOME ,
47 .BR $USER ,
48 .BR $SHELL ,
49 .BR $PATH ,
50 .BR $LOGNAME ,
51 and
52 .B $MAIL
53 are set according to the appropriate fields in the password entry.
54 .B $PATH
55 defaults to
56 .I /usr\:/local\:/bin:\:/bin:\:/usr\:/bin
57 for normal users, and to
58 .I /usr\:/local\:/sbin:\:/usr\:/local\:/bin:\:/sbin:\:/bin:\:/usr\:/sbin:\:/usr\:/bin
59 for root, if not otherwise configured.
60 .P
61 The environment variable
62 .B $TERM
63 will be preserved, if it exists (other environment variables are
64 preserved if the
65 .B \-p
66 option is given), else it will be initialized to the terminal type on your tty.
67 .PP
68 Then the user's shell is started. If no shell is specified for the
69 user in
70 .IR /etc\:/passwd ,
71 then
72 .I /bin\:/sh
73 is used. If there is no directory specified in
74 .IR /etc\:/passwd ,
75 then
76 .I /
77 is used (the home directory is checked for the
78 .I .hushlogin
79 file described below).
80 .PP
81 If the file
82 .I .hushlogin
83 exists, then a "quiet" login is performed (this disables the checking
84 of mail and the printing of the last login time and message of the
85 day). Otherwise, if
86 .I /var\:/log\:/lastlog
87 exists, the last login time is printed (and the current login is
88 recorded).
89 .SH OPTIONS
90 .TP
91 .B \-p
92 Used by
93 .BR getty (8)
94 to tell
95 .B login
96 not to destroy the environment.
97 .TP
98 .B \-f
99 Used to skip a second login authentication. This specifically does
100 .B not
101 work for root, and does not appear to work well under Linux.
102 .TP
103 .B \-h
104 Used by other servers (i.e.,
105 .BR telnetd (8))
106 to pass the name of the remote host to
107 .B login
108 so that it may be placed in utmp and wtmp. Only the superuser may
109 use this option.
110 .IP
111 Note that the
112 .B \-h
113 option has impact on the
114 .B PAM service
115 .BR name .
116 The standard service name is
117 .IR login ,
118 with the
119 .B \-h
120 option the name is
121 .IR remote .
122 It is necessary to create proper PAM config files (e.g.
123 .I /etc\:/pam.d\:/login
124 and
125 .IR /etc\:/pam.d\:/remote ).
126 .TP
127 .B \-H
128 Used by other servers (i.e.,
129 .BR telnetd (8))
130 to tell
131 .B login
132 that printing the hostname should be suppressed in the login: prompt.
133 .TP
134 \fB\-\-help\fR
135 Display help text and exit.
136 .TP
137 \fB\-V\fR, \fB\-\-version\fR
138 Display version information and exit.
139 .SH CONFIG FILE ITEMS
140 .B login
141 reads the
142 .IR /etc\:/login.defs (5)
143 configuration file. Note that the configuration file could be
144 distributed with another package (e.g. shadow-utils). The following
145 configuration items are relevant for
146 .BR login (1):
147 .PP
148 .B MOTD_FILE
149 (string)
150 .RS 4
151 If defined, a ":" delimited list of "message of the day" files to be
152 displayed upon login. The default value is
153 .IR /etc\:/motd .
154 If the
155 .B MOTD_FILE
156 item is empty or a quiet login is enabled, then the message of the day
157 is not displayed. Note that the same functionality is also provided
158 by
159 .BR pam_motd (8)
160 PAM module.
161 .RE
162 .PP
163 .B LOGIN_TIMEOUT
164 (number)
165 .RS 4
166 Max time in seconds for login. The default value is
167 .IR 60 .
168 .RE
169 .PP
170 .B LOGIN_RETRIES
171 (number)
172 .RS 4
173 Maximum number of login retries in case of a bad password. The default
174 value is
175 .IR 3 .
176 .RE
177 .PP
178 .B FAIL_DELAY
179 (number)
180 .RS 4
181 Delay in seconds before being allowed another three tries after a
182 login failure. The default value is
183 .IR 5 .
184 .RE
185 .PP
186 .B TTYPERM
187 (string)
188 .RS 4
189 The terminal permissions. The default value is
190 .IR 0600
191 or
192 .IR 0620
193 if tty group is used.
194 .RE
195 .PP
196 .B TTYGROUP
197 (string)
198 .RS 4
199 The login tty will be owned by the
200 .BR TTYGROUP .
201 The default value is
202 .IR tty .
203 If the
204 .B TTYGROUP
205 does not exist, then the ownership of the terminal is set to the
206 user\'s primary group.
207 .PP
208 The
209 .B TTYGROUP
210 can be either the name of a group or a numeric group identifier.
211 .RE
212 .PP
213 .B HUSHLOGIN_FILE
214 (string)
215 .RS 4
216 If defined, this file can inhibit all the usual chatter during the
217 login sequence. If a full pathname (e.g.
218 .IR /etc\:/hushlogins )
219 is specified, then hushed mode will be enabled if the user\'s name or
220 shell are found in the file. If this global hush login file is empty
221 then the hushed mode will be enabled for all users.
222 .PP
223 If a full pathname is not specified, then hushed mode will be enabled
224 if the file exists in the user\'s home directory.
225 .PP
226 The default is to check
227 .I /etc\:/hushlogins
228 and if it does not exist then
229 .I ~/.hushlogin
230 .PP
231 If the
232 .B HUSHLOGIN_FILE
233 item is empty, then all the checks are disabled.
234 .RE
235 .PP
236 .B DEFAULT_HOME
237 (boolean)
238 .RS 4
239 Indicate if login is allowed if we cannot change directory to the
240 home directory. If set to
241 .IR yes ,
242 the user will login in the root (/) directory if it is not possible
243 to change directory to her home. The default value is
244 .IR yes .
245 .RE
246 .PP
247 .B LOG_UNKFAIL_ENAB
248 (boolean)
249 .RS 4
250 Enable display of unknown usernames when login failures are recorded.
251 The default value is
252 .IR no .
253 .PP
254 Note that logging unknown usernames may be a security issue if a
255 user enters her password instead of her login name.
256 .RE
257 .PP
258 .B ENV_PATH
259 (string)
260 .RS 4
261 If set, it will be used to define the PATH environment variable when
262 a regular user logs in. The default value is
263 .I /usr\:/local\:/bin:\:/bin:\:/usr\:/bin
264 .RE
265 .PP
266 .B ENV_ROOTPATH
267 (string)
268 .br
269 .B ENV_SUPATH
270 (string)
271 .RS 4
272 If set, it will be used to define the PATH environment variable when
273 the superuser logs in. The default value is
274 .I /usr\:/local\:/sbin:\:/usr\:/local\:/bin:\:/sbin:\:/bin:\:/usr\:/sbin:\:/usr\:/bin
275 .RE
276 .SH FILES
277 .nf
278 .I /var/run/utmp
279 .I /var/log/wtmp
280 .I /var/log/lastlog
281 .I /var/spool/mail/*
282 .I /etc/motd
283 .I /etc/passwd
284 .I /etc/nologin
285 .I /etc/pam.d/login
286 .I /etc/pam.d/remote
287 .I /etc/hushlogins
288 .I .hushlogin
289 .fi
290 .SH "SEE ALSO"
291 .BR mail (1),
292 .BR passwd (1),
293 .BR passwd (5),
294 .BR environ (7),
295 .BR getty (8),
296 .BR init (8),
297 .BR shutdown (8)
298 .SH BUGS
299 The undocumented BSD
300 .B \-r
301 option is not supported. This may be required by some
302 .BR rlogind (8)
303 programs.
304 .PP
305 A recursive login, as used to be possible in the good old days, no
306 longer works; for most purposes
307 .BR su (1)
308 is a satisfactory substitute. Indeed, for security reasons, login
309 does a vhangup() system call to remove any possible listening
310 processes on the tty. This is to avoid password sniffing. If one
311 uses the command
312 .BR login ,
313 then the surrounding shell gets killed by vhangup() because it's no
314 longer the true owner of the tty. This can be avoided by using
315 .B exec login
316 in a top-level shell or xterm.
317 .SH AUTHOR
318 Derived from BSD login 5.40 (5/9/89) by
319 .MT glad@\:daimi.\:dk
320 Michael Glad
321 .ME
322 for HP-UX
323 .br
324 Ported to Linux 0.12:
325 .MT poe@\:daimi.\:aau.\:dk
326 Peter Orbaek
327 .ME
328 .br
329 Rewritten to a PAM-only version by
330 .MT kzak@\:redhat.\:com
331 Karel Zak
332 .ME
333 .SH AVAILABILITY
334 The login command is part of the util-linux package and is
335 available from
336 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
337 Linux Kernel Archive
338 .UE .