1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\" May be distributed under the GNU General Public License
3 .TH LOGIN 1 "4 November 1996" "Util-linux 1.6" "Linux Programmer's Manual"
7 .BR "login [ " name " ]"
11 .BR "login \-h " hostname
16 is used when signing onto a system. It can also be used to switch from one
17 user to another at any time (most modern shells have support for this
18 feature built into them, however).
20 If an argument is not given,
22 prompts for the username.
28 exists, the contents of this file are printed to the screen, and the
29 login is terminated. This is typically used to prevent logins when the
30 system is being taken down.
32 If special access restrictions are specified for the user in
34 these must be met, or the log in attempt will be denied and a
36 message will be generated. See the section on "Special Access Restrictions".
38 If the user is root, then the login must be occurring on a tty listed in
40 Failures will be logged with the
44 After these conditions have been checked, the password will be requested and
45 checked (if a password is required for this username). Ten attempts
48 dies, but after the first three, the response starts to get very slow.
49 Login failures are reported via the
51 facility. This facility is also used to report any successful root logins.
55 exists, then a "quiet" login is performed (this disables the checking
56 of mail and the printing of the last login time and message of the day).
59 exists, the last login time is printed (and the current login is
62 Random administrative things, such as setting the UID and GID of the
63 tty are performed. The TERM environment variable is preserved, if it
64 exists (other environment variables are preserved if the
66 option is used). Then the HOME, PATH, SHELL, TERM, MAIL, and LOGNAME
67 environment variables are set. PATH defaults to
68 .I /usr/local/bin:/bin:/usr/bin
69 for normal users, and to
70 .I /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
71 for root. Last, if this is not a "quiet" login, the message of the
72 day is printed and the file with the user's name in
74 will be checked, and a message printed if it has non-zero length.
76 The user's shell is then started. If no shell is specified for the
81 is used. If there is no directory specified in
85 is used (the home directory is checked for the
87 file described above).
95 not to destroy the environment
98 Used to skip a second login authentication. This specifically does
100 work for root, and does not appear to work well under Linux.
103 Used by other servers (i.e.,
105 to pass the name of the remote host to
107 so that it may be placed in utmp and wtmp. Only the superuser may use
110 .SH "SPECIAL ACCESS RESTRICTIONS"
113 lists the names of the ttys where root is allowed to log in. One name
114 of a tty device without the /dev/ prefix must be specified on each
115 line. If the file does not exist, root is allowed to log in on any
118 On most modern Linux systems PAM (Pluggable Authentication Modules)
119 is used. On systems that do not use PAM, the file
121 specifies additional access restrictions for specific users.
122 If this file does not exist, no additional access restrictions are
123 imposed. The file consists of a sequence of sections. There are three
124 possible section types: CLASSES, GROUPS and USERS. A CLASSES section
125 defines classes of ttys and hostname patterns, A GROUPS section
126 defines allowed ttys and hosts on a per group basis, and a USERS
127 section defines allowed ttys and hosts on a per user basis.
129 Each line in this file in may be no longer than 255
130 characters. Comments start with # character and extend to the end of
133 .SS "The CLASSES Section"
134 A CLASSES section begins with the word CLASSES at the start of a line
135 in all upper case. Each following line until the start of a new
136 section or the end of the file consists of a sequence of words
137 separated by tabs or spaces. Each line defines a class of ttys and
140 The word at the beginning of a line becomes defined as a collective
141 name for the ttys and host patterns specified at the rest of the
142 line. This collective name can be used in any subsequent GROUPS or
143 USERS section. No such class name must occur as part of the definition
144 of a class in order to avoid problems with recursive classes.
146 An example CLASSES section:
152 myclass2 tty3 @.foo.com
156 This defines the classes
160 as the corresponding right hand sides.
163 .SS "The GROUPS Section"
164 A GROUPS section defines allowed ttys and hosts on a per Unix group basis. If
165 a user is a member of a Unix group according to
169 and such a group is mentioned in a GROUPS section in
171 then the user is granted access if the group is.
173 A GROUPS section starts with the word GROUPS in all upper case at the start of
174 a line, and each following line is a sequence of words separated by spaces
175 or tabs. The first word on a line is the name of the group and the rest
176 of the words on the line specifies the ttys and hosts where members of that
177 group are allowed access. These specifications may involve the use of
178 classes defined in previous CLASSES sections.
180 An example GROUPS section.
190 This example specifies that members of group
192 may log in on tty1 and from hosts in the bar.edu domain. Users in
195 may log in from hosts/ttys specified in the class myclass1 or from
199 .SS "The USERS Section"
200 A USERS section starts with the word USERS in all upper case at the
201 start of a line, and each following line is a sequence of words
202 separated by spaces or tabs. The first word on a line is a username
203 and that user is allowed to log in on the ttys and from the hosts
204 mentioned on the rest of the line. These specifications may involve
205 classes defined in previous CLASSES sections. If no section header is
206 specified at the top of the file, the first section defaults to be a
209 An example USERS section:
214 zacho tty1 @130.225.16.0/255.255.255.0
219 This lets the user zacho login only on tty1 and from hosts with IP
220 addreses in the range 130.225.16.0 \- 130.225.16.255, and user blue is
221 allowed to log in from tty3 and whatever is specified in the class
224 There may be a line in a USERS section starting with a username of
225 *. This is a default rule and it will be applied to any user not
226 matching any other line.
228 If both a USERS line and GROUPS line match a user then the user is
229 allowed access from the union of all the ttys/hosts mentioned in these
233 The tty and host pattern specifications used in the specification of
234 classes, group and user access are called origins. An origin string
235 may have one of these formats:
237 The name of a tty device without the /dev/ prefix, for example tty1 or
241 The string @localhost, meaning that the user is allowed to
242 telnet/rlogin from the local host to the same host. This also allows
243 the user to for example run the command: xterm -e /bin/login.
246 A domain name suffix such as @.some.dom, meaning that the user may
247 rlogin/telnet from any host whose domain name has the suffix
251 A range of IPv4 addresses, written @x.x.x.x/y.y.y.y where x.x.x.x is
252 the IP address in the usual dotted quad decimal notation, and y.y.y.y
253 is a bitmask in the same notation specifying which bits in the address
254 to compare with the IP address of the remote host. For example
255 @130.225.16.0/255.255.254.0 means that the user may rlogin/telnet from
256 any host whose IP address is in the range 130.225.16.0 \-
259 Any of the above origins may be prefixed by a time specification
260 according to the syntax:
263 timespec ::= '[' <day-or-hour> [':' <day-or-hour>]* ']'
264 day ::= 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun'
265 hour ::= '0' | '1' | ... | '23'
266 hourspec ::= <hour> | <hour> '\-' <hour>
267 day-or-hour ::= <day> | <hourspec>
270 For example, the origin [mon:tue:wed:thu:fri:8\-17]tty3 means that log
271 in is allowed on mondays through fridays between 8:00 and 17:59 (5:59
272 pm) on tty3. This also shows that an hour range a\-b includes all
273 moments between a:00 and b:59. A single hour specification (such as
274 10) means the time span between 10:00 and 10:59.
276 Not specifying any time prefix for a tty or host means log in from
277 that origin is allowed any time. If you give a time prefix be sure to
278 specify both a set of days and one or more hours or hour ranges. A
279 time specification may not include any white space.
281 If no default rule is given then users not matching any line
283 are allowed to log in from anywhere as is standard behavior.
309 option is not supported. This may be required by some
313 A recursive login, as used to be possible in the good old days,
314 no longer works; for most purposes
316 is a satisfactory substitute. Indeed, for security reasons,
317 login does a vhangup() system call to remove any possible
318 listening processes on the tty. This is to avoid password
319 sniffing. If one uses the command "login", then the surrounding shell
320 gets killed by vhangup() because it's no longer the true owner of the tty.
321 This can be avoided by using "exec login" in a top-level shell or xterm.
323 Derived from BSD login 5.40 (5/9/89) by Michael Glad (glad@daimi.dk)
326 Ported to Linux 0.12: Peter Orbaek (poe@daimi.aau.dk)