1.\" $OpenBSD: login.1,v 1.24 2005/06/02 07:51:37 jmc Exp $ 2.\" 3.\" Copyright (c) 1980, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)login.1 8.2 (Berkeley) 5/5/94 31.\" 32.Dd May 5, 1994 33.Dt LOGIN 1 34.Os 35.Sh NAME 36.Nm login 37.Nd log into the computer 38.Sh SYNOPSIS 39.Nm login 40.Op Fl fp 41.Op Fl h Ar hostname 42.Op Fl L Ar local-ip-address 43.Op Fl R Ar remote-ip-address 44.Op Fl u Ar username 45.Op Ar user 46.Sh DESCRIPTION 47The 48.Nm 49utility logs users (and pseudo-users) into the computer system. 50.Pp 51If no user is specified, or if a user is specified and authentication 52of the user fails, 53.Nm 54prompts for a user name. 55Authentication of users is normally done via passwords, though 56external authentication mechanisms may be used (see 57.Xr login.conf 5 ) . 58To specify the alternate authentication mechanism 59.Va style , 60the string 61.Li : Ns Va style 62is appended to the user name (i.e., 63.Ar user Ns Li : Ns Va style ) . 64.Pp 65The options are as follows: 66.Bl -tag -width Ds 67.It Fl f 68The 69.Fl f 70option is used when a user name is specified to indicate that proper 71authentication has already been done and that no password need be 72requested. 73This option may only be used by the superuser or when an already 74logged in user is logging in as themselves. 75.It Fl h Ar hostname 76Specifies the host from which the connection was received. 77This option may only be used by the superuser. 78.It Fl L 79The 80.Fl L 81option specifies the local IP address of a socket. 82This information is passed on to any classify script (see 83.Xr login.conf 5 ) . 84.It Fl p 85By default, 86.Nm 87discards any previous environment. 88The 89.Fl p 90option disables this behavior. 91.It Fl R 92The 93.Fl R 94option specifies the remote IP address of a socket. 95This information is passed on to any classify script (see 96.Xr login.conf 5 ) . 97.It Fl u Ar username 98Specifies the remote user that initiated the connection. 99This option may only be used by the superuser. 100.El 101.Pp 102If the file 103.Pa /etc/nologin 104exists (and the 105.Dq ignorenologin 106boolean is not set in the user's login class), 107.Nm 108displays its contents to the user and exits. 109This is used by 110.Xr shutdown 8 111to prevent users from logging in when the system is about to go down. 112.Pp 113If the file 114.Pa /etc/fbtab 115exists, 116.Nm 117changes the protection and ownership of certain devices specified in this 118file. 119.Pp 120If the file 121.Pa /var/log/failedlogin 122exists, 123.Nm 124will record failed login attempts in this file. 125.Pp 126Immediately after logging a user in, 127.Nm 128displays the system copyright notice, the date and time the user last 129logged in, the date and time of the last unsuccessful login (if the file 130.Pa /var/log/failedlogin 131exists), the message of the day as well as other information. 132If the file 133.Dq Pa .hushlogin 134exists in the user's home directory, all of these messages are suppressed. 135This is to simplify logins for non-human users, such as 136.Xr uucp . 137.Nm 138then records an entry in the 139.Xr wtmp 5 140and 141.Xr utmp 5 142files and executes the user's command interpreter. 143.Pp 144.Nm 145enters information into the environment (see 146.Xr environ 7 ) 147specifying the user's home directory 148.Pq Ev HOME , 149command interpreter 150.Pq Ev SHELL , 151search path 152.Pq Ev PATH , 153terminal type 154.Pq Ev TERM , 155and user name 156.Po both Ev LOGNAME and Ev USER 157.Pc . 158.Pp 159The standard shells, 160.Xr csh 1 161and 162.Xr sh 1 , 163do not fork before executing the 164.Nm 165utility. 166.Pp 167Note that if 168.Nm 169is invoked by a non-root user, it will execute 170.Xr su 1 171in 172.Nm 173emulation mode instead. 174.Sh ENVIRONMENT 175.Nm 176sets the following environment variables: 177.Bl -tag -width REMOTEHOST 178.It Ev HOME 179The user's home directory, as specified by the password database. 180.It Ev SHELL 181The user's shell, as specified by the password database. 182.It Ev TERM 183The user's terminal type, if it can be determined. 184.It Ev LOGNAME 185The user's login name. 186.It Ev USER 187Same as 188.Ev LOGNAME . 189.It Ev REMOTEHOST 190The name of the host from which the user logged in, if the 191.Fl h 192flag was specified. 193.It Ev REMOTEUSER 194The name of the remote user who initiated the connection, if the 195.Fl u 196flag was specified. 197.El 198.Pp 199Other environment variables may be specified in 200.Pa /etc/login.conf 201via the 202.Dq setenv 203capability. 204.Sh FILES 205.Bl -tag -width /var/log/failedlogin -compact 206.It Pa /etc/fbtab 207changes device protections 208.It Pa /etc/login.conf 209login configuration 210.It Pa /etc/motd 211message-of-the-day 212.It Pa /etc/nologin 213disallows logins 214.It Pa /var/run/utmp 215current logins 216.It Pa /var/log/failedlogin 217failed login account records 218.It Pa /var/log/lastlog 219last login account records 220.It Pa /var/log/wtmp 221login account records 222.It Pa /var/mail/user 223system mailboxes 224.It Pa \&.hushlogin 225makes login quieter 226.El 227.Sh SEE ALSO 228.Xr chpass 1 , 229.Xr passwd 1 , 230.Xr su 1 , 231.Xr telnet 1 , 232.Xr getpass 3 , 233.Xr setusercontext 3 , 234.Xr fbtab 5 , 235.Xr login.conf 5 , 236.Xr utmp 5 , 237.Xr environ 7 238.Sh HISTORY 239A 240.Nm 241utility appeared in 242.At v3 . 243