]> git.ipfire.org Git - thirdparty/util-linux.git/blob - login-utils/login.1
Merge branch 'mps_losetup_has_device_inline' of https://github.com/marcosps/util...
[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 .B \-p
10 ] [
11 .B \-h
12 .I host
13 ] [
14 .B \-H
15 ] [
16 .B \-f
17 .I username
18 |
19 .I 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 See also LOGIN_PLAIN_PROMPT below if your server does not allow to configure
134 .B login
135 command line.
136 .TP
137 \fB\-\-help\fR
138 Display help text and exit.
139 .TP
140 \fB\-V\fR, \fB\-\-version\fR
141 Display version information and exit.
142 .SH CONFIG FILE ITEMS
143 .B login
144 reads the
145 .IR /etc\:/login.defs (5)
146 configuration file. Note that the configuration file could be
147 distributed with another package (e.g. shadow-utils). The following
148 configuration items are relevant for
149 .BR login (1):
150 .PP
151 .B MOTD_FILE
152 (string)
153 .RS 4
154 If defined, a ":" delimited list of "message of the day" files to be
155 displayed upon login. The default value is
156 .IR /etc\:/motd .
157 If the
158 .B MOTD_FILE
159 item is empty or a quiet login is enabled, then the message of the day
160 is not displayed. Note that the same functionality is also provided
161 by
162 .BR pam_motd (8)
163 PAM module.
164 .RE
165 .PP
166 .B LOGIN_PLAIN_PROMPT
167 (boolean)
168 .RS 4
169 Tell login that printing the hostname should be suppressed in the login:
170 prompt. This is alternative to the \fB\-H\fR command line option. The default
171 value is
172 .IR no .
173 .RE
174 .PP
175 .B LOGIN_TIMEOUT
176 (number)
177 .RS 4
178 Max time in seconds for login. The default value is
179 .IR 60 .
180 .RE
181 .PP
182 .B LOGIN_RETRIES
183 (number)
184 .RS 4
185 Maximum number of login retries in case of a bad password. The default
186 value is
187 .IR 3 .
188 .RE
189 .PP
190 .B FAIL_DELAY
191 (number)
192 .RS 4
193 Delay in seconds before being allowed another three tries after a
194 login failure. The default value is
195 .IR 5 .
196 .RE
197 .PP
198 .B TTYPERM
199 (string)
200 .RS 4
201 The terminal permissions. The default value is
202 .I 0600
203 or
204 .I 0620
205 if tty group is used.
206 .RE
207 .PP
208 .B TTYGROUP
209 (string)
210 .RS 4
211 The login tty will be owned by the
212 .BR TTYGROUP .
213 The default value is
214 .IR tty .
215 If the
216 .B TTYGROUP
217 does not exist, then the ownership of the terminal is set to the
218 user\'s primary group.
219 .PP
220 The
221 .B TTYGROUP
222 can be either the name of a group or a numeric group identifier.
223 .RE
224 .PP
225 .B HUSHLOGIN_FILE
226 (string)
227 .RS 4
228 If defined, this file can inhibit all the usual chatter during the
229 login sequence. If a full pathname (e.g.
230 .IR /etc\:/hushlogins )
231 is specified, then hushed mode will be enabled if the user\'s name or
232 shell are found in the file. If this global hush login file is empty
233 then the hushed mode will be enabled for all users.
234 .PP
235 If a full pathname is not specified, then hushed mode will be enabled
236 if the file exists in the user\'s home directory.
237 .PP
238 The default is to check
239 .I /etc\:/hushlogins
240 and if it does not exist then
241 .I ~/.hushlogin
242 .PP
243 If the
244 .B HUSHLOGIN_FILE
245 item is empty, then all the checks are disabled.
246 .RE
247 .PP
248 .B DEFAULT_HOME
249 (boolean)
250 .RS 4
251 Indicate if login is allowed if we cannot change directory to the
252 home directory. If set to
253 .IR yes ,
254 the user will login in the root (/) directory if it is not possible
255 to change directory to her home. The default value is
256 .IR yes .
257 .RE
258 .PP
259 .B LASTLOG_UID_MAX
260 (unsigned number)
261 .RS 4
262 Highest user ID number for which the lastlog entries should be
263 updated. As higher user IDs are usually tracked by remote user
264 identity and authentication services there is no need to create
265 a huge sparse lastlog file for them. No LASTLOG_UID_MAX option
266 present in the configuration means that there is no user ID limit
267 for writing lastlog entries.
268 .RE
269 .PP
270 .B LOG_UNKFAIL_ENAB
271 (boolean)
272 .RS 4
273 Enable display of unknown usernames when login failures are recorded.
274 The default value is
275 .IR no .
276 .PP
277 Note that logging unknown usernames may be a security issue if a
278 user enters her password instead of her login name.
279 .RE
280 .PP
281 .B ENV_PATH
282 (string)
283 .RS 4
284 If set, it will be used to define the PATH environment variable when
285 a regular user logs in. The default value is
286 .I /usr\:/local\:/bin:\:/bin:\:/usr\:/bin
287 .RE
288 .PP
289 .B ENV_ROOTPATH
290 (string)
291 .br
292 .B ENV_SUPATH
293 (string)
294 .RS 4
295 If set, it will be used to define the PATH environment variable when
296 the superuser logs in. ENV_ROOTPATH takes precedence. The default value is
297 .I /usr\:/local\:/sbin:\:/usr\:/local\:/bin:\:/sbin:\:/bin:\:/usr\:/sbin:\:/usr\:/bin
298 .RE
299 .SH FILES
300 .nf
301 .I /var/run/utmp
302 .I /var/log/wtmp
303 .I /var/log/lastlog
304 .I /var/spool/mail/*
305 .I /etc/motd
306 .I /etc/passwd
307 .I /etc/nologin
308 .I /etc/pam.d/login
309 .I /etc/pam.d/remote
310 .I /etc/hushlogins
311 .I .hushlogin
312 .fi
313 .SH "SEE ALSO"
314 .BR mail (1),
315 .BR passwd (1),
316 .BR passwd (5),
317 .BR environ (7),
318 .BR getty (8),
319 .BR init (8),
320 .BR shutdown (8)
321 .SH BUGS
322 The undocumented BSD
323 .B \-r
324 option is not supported. This may be required by some
325 .BR rlogind (8)
326 programs.
327 .PP
328 A recursive login, as used to be possible in the good old days, no
329 longer works; for most purposes
330 .BR su (1)
331 is a satisfactory substitute. Indeed, for security reasons, login
332 does a vhangup() system call to remove any possible listening
333 processes on the tty. This is to avoid password sniffing. If one
334 uses the command
335 .BR login ,
336 then the surrounding shell gets killed by vhangup() because it's no
337 longer the true owner of the tty. This can be avoided by using
338 .B exec login
339 in a top-level shell or xterm.
340 .SH AUTHOR
341 Derived from BSD login 5.40 (5/9/89) by
342 .MT glad@\:daimi.\:dk
343 Michael Glad
344 .ME
345 for HP-UX
346 .br
347 Ported to Linux 0.12:
348 .MT poe@\:daimi.\:aau.\:dk
349 Peter Orbaek
350 .ME
351 .br
352 Rewritten to a PAM-only version by
353 .MT kzak@\:redhat.\:com
354 Karel Zak
355 .ME
356 .SH AVAILABILITY
357 The login command is part of the util-linux package and is
358 available from
359 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
360 Linux Kernel Archive
361 .UE .