xref: /original-bsd/usr.bin/login/login.1 (revision ba762ddc)
1.\" Copyright (c) 1980, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"	@(#)login.1	6.11 (Berkeley) 04/26/91
7.\"
8.Dd
9.Dt LOGIN 1
10.Os BSD 4
11.Sh NAME
12.Nm login
13.Nd log on to a system
14.Sh SYNOPSIS
15.Nm login
16.Op Fl p
17.Op Ar user
18.Nm login
19.Op Fl p
20.Op Fl h Ar hostname
21.Op Fl f
22.Op Ar user
23.Sh DESCRIPTION
24The
25.Nm login
26command
27logs the given user
28.Ar user
29onto a
30.Tn UNIX
31system.
32It has three different uses;
33logging a user on to a system,
34re-logging a user in as another
35user (without logging out),
36and logging non-human users (programs)
37onto other systems.
38In the first two instances, the
39.Nm login
40program protects the user's password
41from prying eyes by disabling the
42echoing of typed characters from terminals.
43.Pp
44Options available:
45.Bl -tag -width xxxxhostname
46.It Fl f
47The
48.Fl f
49option is used with
50a username on the command line, at initial login,
51to indicate that proper authentication has already been done
52and that no password need be requested.
53This option may be used by the superuser
54or by the user specified on the command line.
55.It Fl h Ar hostname
56The
57.Fl h
58option is used by
59.Xr telnetd  8
60(at initial login)
61and other servers to list the host from which
62the connection was received.
63.It Fl p
64Causes the remainder of the environment to be preserved,
65otherwise any previous environment is discarded.
66.El
67.Pp
68In the first usage of
69.Nm login
70it is invoked by the
71.Xr getty 8
72program which is responsible for initializing communications between
73a users terminal and
74.Tn UNIX .
75.Nm Login
76starts up
77by prompting for a user name; when it recives a valid user name and password
78the user is logged in and may proceed to work on the system.
79.Pp
80The second usage of
81.Nm login
82allows a user to log in as another user
83without having logout.
84In this case
85.Nm login
86is invoked from
87.Xr sh 1
88or
89.Xr csh 1
90as shown above in the first synopsis.
91.Pp
92The third usage is by system programs and servers like
93.Xr telnetd
94and may only be initiated by the super-user.
95.Pp
96Immediately after logging a user in,
97.Nm login
98writes the date and time the user last logged in,
99the message of the day and notifies the user
100if he/she has new mail.
101If the file
102.Dq Pa .hushlogin
103exists in the user's home directory,
104both the message of the day and mail notification are
105suppressed; this
106is usually used to simplify the logins for non-human users, such as
107.Xr uucp 1 .
108.Nm login
109then records an entry in the
110.Xr wtmp 5
111and
112.Xr utmp 5
113files and provides the user
114with the command shell found in the user's
115.Xr passwd 5
116entry.
117.Pp
118Login also modifies the
119environment (see
120.Xr environ 7 )
121with information specifying home directory, command interpreter, terminal
122type (if available) and user name.
123.Pp
124If the file
125.Pa /etc/nologin
126exists,
127.Nm login
128prints its contents on the user's terminal and exits. This is
129used by
130.Xr shutdown  8
131to prevent users from logging in when the system is about to go down.
132.Pp
133The standard shells,
134.Xr csh 1
135and
136.Xr sh 1
137notice when login is invoked on a command line and execute
138it immediately with out calling
139.Xr fork 2 .
140.Sh FILES
141.Bl -tag -width /var/log/wtmp -compact
142.It Pa /var/run/utmp
143current logins
144.It Pa /var/log/wtmp
145login account records
146.It Pa /var/mail/*
147undelivered mail
148.It Pa /etc/motd
149message-of-the-day
150.It Pa /etc/passwd.*
151password files
152.It Pa /etc/nologin
153disallows logins
154.It Pa \&.hushlogin
155makes login quieter
156.El
157.Sh SEE ALSO
158.Xr mail 1 ,
159.Xr passwd 1 ,
160.Xr rlogin 1 ,
161.Xr getpass 3 ,
162.Xr passwd 5 ,
163.Xr utmp 5 ,
164.Xr environ 7 ,
165.Xr init 8 ,
166.Xr getty 8 ,
167.Xr shutdown 8 ,
168.Sh HISTORY
169A
170.Nm login
171appeared in
172.At v6 .
173.Sh DIAGNOSTICS
174Self explanatory.
175