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