]> git.ipfire.org Git - thirdparty/util-linux.git/blame - login-utils/login.1
login: add -H option for compatibility with Suse
[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
232dc924 3.TH LOGIN 1 "March 2009" "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
bc4aa3b5 23is used when signing onto a system.
7d6b450d 24If no argument is given,
6dbe3af9
KZ
25.B login
26prompts for the username.
27
7d6b450d
KZ
28The user is then prompted for a password, where approprate. Echoing is
29disabled to prevent revealing the password. Only a small number of password
30failures are permitted before
6dbe3af9 31.B login
7d6b450d 32exits and the communications link is severed.
6dbe3af9 33
7d6b450d
KZ
34If password aging has been enabled for the account, the user may be prompted
35for a new password before proceeding. He will be forced to provide his old
36password and the new password before continuing. Please refer to
37.BR passwd (1)
38for more information.
6dbe3af9 39
7d6b450d
KZ
40The user and group ID will be set according to their values in the
41.I /etc/passwd
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 prevent
44that the system adminitrator cannot login in case of network problems.
45The value for
46.BR $HOME ,
47.BR $SHELL ,
48.BR $PATH ,
49.BR $LOGNAME ,
50and
51.B $MAIL
52are set according to the appropriate fields in the password entry.
53.B $PATH
54defaults to
55.I /usr/local/bin:/bin:/usr/bin:.
6dbe3af9 56for normal users, and to
7d6b450d
KZ
57.I /sbin:/bin:/usr/sbin:/usr/bin
58for root if not other configured.
6dbe3af9 59
7d6b450d
KZ
60The environment variable
61.B $TERM
62will be preserved, if it exists (other environment variables are
63preserved if the
64.B \-p
65option is given) or be initialize to the terminal type on your tty
66
67Then the user's shell is started. If no shell is specified for the
fd6b7a7f 68user in
6dbe3af9
KZ
69.BR /etc/passwd ,
70then
71.B /bin/sh
72is used. If there is no directory specified in
73.IR /etc/passwd ,
74then
75.I /
76is used (the home directory is checked for the
77.I .hushlogin
7d6b450d
KZ
78file described below).
79
80If the file
81.I .hushlogin
82exists, then a "quiet" login is performed (this disables the checking
83of mail and the printing of the last login time and message of the day).
84Otherwise, if
85.I /var/log/lastlog
86exists, the last login time is printed (and the current login is
87recorded).
88
6dbe3af9
KZ
89.SH OPTIONS
90.TP
91.B \-p
92Used by
93.BR getty (8)
94to tell
95.B login
96not to destroy the environment
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
fd6b7a7f
KZ
108so that it may be placed in utmp and wtmp. Only the superuser may use
109this option.
726f69e2 110
067f5343
KZ
111Note that the \fB-h\fP option has impact on the \fBPAM service name\fP. The standard
112service name is "login", with the \fB-h\fP option the name is "remote". It's
113necessary to create a proper PAM config files (e.g.
114.I /etc/pam.d/login
115and
116.I /etc/pam.d/remote
117).
92e386ca
KZ
118.TP
119.B \-H
120Used by other servers (i.e.,
121.BR telnetd (8))
122to tell
123.B login
124that printing the hostname should be suppressed in the login: prompt.
4d8fc09c
KZ
125
126.SH CONFIG FILE ITEMS
127.B login
128reads the
129.IR /etc/login.defs (5)
130configuration file. Note that the configuration file could be distributed with
131another package (e.g. shadow-utils). The following configuration items are
132relevant for
133.BR login (1):
134.PP
135\fBMOTD_FILE\fR (string)
136.RS 4
137If defined, ":" delimited list of "message of the day" files to be displayed
138upon login. The default value is "/etc/motd". If the \fBMOTD_FILE\fR item is
139empty or "quiet" login is enabled then the message of the day is not displayed.
140Note that the same functionality is also provided by
141.BR pam_motd (8)
142PAM module.
143.RE
9abd9cde
KZ
144.PP
145\fBLOGIN_TIMEOUT\fR (number)
146.RS 4
147Max time in seconds for login. The default value is 60.
148.RE
ca5ee2a8
KZ
149.PP
150\fBFAIL_DELAY\fR (number)
151.RS 4
152Delay in seconds before being allowed another attempt after a login failure.
153The default value is 5.
154.RE
738246ed
KZ
155.PP
156\fBTTYPERM\fR (string)
157.RS 4
158The terminal permissions. The default value is 0600.
159.RE
45d0a30e
KZ
160.PP
161\fBTTYGROUP\fR (string)
162.RS 4
163The login tty will be owned by the
164\fBTTYGROUP\fR. The default value is 'tty'. If the \fBTTYGROUP\fR does not exist
165then the ownership of the terminal is set to the user\'s primary group.
166.SP
167The \fBTTYGROUP\fR can be either the name of a group or a numeric group identifier.
168.RE
84d3c9ff
KZ
169.PP
170\fBHUSHLOGIN_FILE\fR (string)
171.RS 4
172If defined, this file can inhibit all the usual chatter during the login
173sequence. If a full pathname (e.g. /etc/hushlogins) is specified, then hushed
174mode will be enabled if the user\'s name or shell are found in the file. If
175this global hush login file is empty then the hushed mode will be enabled for
176all users.
177
178If not a full pathname is specified, then hushed mode will be enabled if the
179file exists in the user\'s home directory.
738246ed 180
84d3c9ff
KZ
181The default is to check "/etc/hushlogins" and if does not exist then
182"~/.hushlogin".
183
184If the \fBHUSHLOGIN_FILE\fR item is empty then all checks are disabled.
185.RE
91d0a913
KZ
186.PP
187\fBDEFAULT_HOME\fR (boolean)
188.RS 4
189Indicate if login is allowed if we can\'t cd to the home directory. If set to
190\fIyes\fR, the user will login in the root (/) directory if it is not possible
191to cd to her home directory. The default value is 'yes'.
192.RE
cea8ec53
KZ
193.PP
194\fBLOG_UNKFAIL_ENAB\fR (boolean)
195.RS 4
196Enable display of unknown usernames when login failures are recorded\&.
197.sp
198Note that logging unknown usernames may be a security issue if an user enter
199her password instead of her login name.
200.RE
6dbe3af9
KZ
201.SH FILES
202.nf
726f69e2
KZ
203.I /var/run/utmp
204.I /var/log/wtmp
205.I /var/log/lastlog
cad18f61 206.I /var/spool/mail/*
6dbe3af9
KZ
207.I /etc/motd
208.I /etc/passwd
209.I /etc/nologin
726f69e2 210.I /etc/usertty
067f5343
KZ
211.I /etc/pam.d/login
212.I /etc/pam.d/remote
6dbe3af9
KZ
213.I .hushlogin
214.fi
215.SH "SEE ALSO"
216.BR init (8),
217.BR getty (8),
218.BR mail (1),
219.BR passwd (1),
220.BR passwd (5),
221.BR environ (7),
222.BR shutdown (8)
223.SH BUGS
fd6b7a7f 224
6dbe3af9
KZ
225The undocumented BSD
226.B \-r
227option is not supported. This may be required by some
228.BR rlogind (8)
229programs.
7eda085c
KZ
230
231A recursive login, as used to be possible in the good old days,
232no longer works; for most purposes
233.BR su (1)
234is a satisfactory substitute. Indeed, for security reasons,
235login does a vhangup() system call to remove any possible
236listening processes on the tty. This is to avoid password
237sniffing. If one uses the command "login", then the surrounding shell
238gets killed by vhangup() because it's no longer the true owner of the tty.
239This can be avoided by using "exec login" in a top-level shell or xterm.
6dbe3af9 240.SH AUTHOR
fd6b7a7f
KZ
241Derived from BSD login 5.40 (5/9/89) by Michael Glad (glad@daimi.dk)
242for HP-UX
6dbe3af9
KZ
243.br
244Ported to Linux 0.12: Peter Orbaek (poe@daimi.aau.dk)
86d62711 245.SH AVAILABILITY
601d12fb
KZ
246The login command is part of the util-linux package and is available from
247ftp://ftp.kernel.org/pub/linux/utils/util-linux/.