Initial commit for Tizen
[profile/extras/shadow-utils.git] / man / login.1
1 '\" t
2 .\"     Title: login
3 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
4 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
5 .\"      Date: 02/16/2011
6 .\"    Manual: User Commands
7 .\"    Source: User Commands
8 .\"  Language: English
9 .\"
10 .TH "LOGIN" "1" "02/16/2011" "User Commands" "User Commands"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 login \- begin session on the system
32 .SH "SYNOPSIS"
33 .HP \w'\fBlogin\fR\ 'u
34 \fBlogin\fR [\-p] [\-h\ \fIhost\fR] [\fIusername\fR] [\fIENV=VAR\fR...]
35 .HP \w'\fBlogin\fR\ 'u
36 \fBlogin\fR [\-p] [\-h\ \fIhost\fR] \-f \fIusername\fR
37 .HP \w'\fBlogin\fR\ 'u
38 \fBlogin\fR [\-p] \-r\ \fIhost\fR
39 .SH "DESCRIPTION"
40 .PP
41 The
42 \fBlogin\fR
43 program is used to establish a new session with the system\&. It is normally invoked automatically by responding to the
44 \fIlogin:\fR
45 prompt on the user\*(Aqs terminal\&.
46 \fBlogin\fR
47 may be special to the shell and may not be invoked as a sub\-process\&. When called from a shell,
48 \fBlogin\fR
49 should be executed as
50 \fBexec login\fR
51 which will cause the user to exit from the current shell (and thus will prevent the new logged in user to return to the session of the caller)\&. Attempting to execute
52 \fBlogin\fR
53 from any shell but the login shell will produce an error message\&.
54 .PP
55 The user is then prompted for a password, where appropriate\&. Echoing is disabled to prevent revealing the password\&. Only a small number of password failures are permitted before
56 \fBlogin\fR
57 exits and the communications link is severed\&.
58 .PP
59 If password aging has been enabled for your account, you may be prompted for a new password before proceeding\&. You will be forced to provide your old password and the new password before continuing\&. Please refer to
60 \fBpasswd\fR(1)
61 for more information\&.
62 .PP
63 After a successful login, you will be informed of any system messages and the presence of mail\&. You may turn off the printing of the system message file,
64 /etc/motd, by creating a zero\-length file
65 \&.hushlogin
66 in your login directory\&. The mail message will be one of "\fIYou have new mail\&.\fR", "\fIYou have mail\&.\fR", or "\fINo Mail\&.\fR" according to the condition of your mailbox\&.
67 .PP
68 Your user and group ID will be set according to their values in the
69 /etc/passwd
70 file\&. The value for
71 \fB$HOME\fR,
72 \fB$SHELL\fR,
73 \fB$PATH\fR,
74 \fB$LOGNAME\fR, and
75 \fB$MAIL\fR
76 are set according to the appropriate fields in the password entry\&. Ulimit, umask and nice values may also be set according to entries in the GECOS field\&.
77 .PP
78 On some installations, the environmental variable
79 \fB$TERM\fR
80 will be initialized to the terminal type on your tty line, as specified in
81 /etc/ttytype\&.
82 .PP
83 An initialization script for your command interpreter may also be executed\&. Please see the appropriate manual section for more information on this function\&.
84 .PP
85 A subsystem login is indicated by the presence of a "*" as the first character of the login shell\&. The given home directory will be used as the root of a new file system which the user is actually logged into\&.
86 .PP
87 The
88 \fBlogin\fR
89 program is NOT responsible for removing users from the utmp file\&. It is the responsibility of
90 \fBgetty\fR(8)
91 and
92 \fBinit\fR(8)
93 to clean up apparent ownership of a terminal session\&. If you use
94 \fBlogin\fR
95 from the shell prompt without
96 \fBexec\fR, the user you use will continue to appear to be logged in even after you log out of the "subsession"\&.
97 .SH "OPTIONS"
98 .PP
99 \fB\-f\fR
100 .RS 4
101 Do not perform authentication, user is preauthenticated\&.
102 .sp
103 Note: In that case,
104 \fIusername\fR
105 is mandatory\&.
106 .RE
107 .PP
108 \fB\-h\fR
109 .RS 4
110 Name of the remote host for this login\&.
111 .RE
112 .PP
113 \fB\-p\fR
114 .RS 4
115 Preserve environment\&.
116 .RE
117 .PP
118 \fB\-r\fR
119 .RS 4
120 Perform autologin protocol for rlogin\&.
121 .RE
122 .PP
123 The
124 \fB\-r\fR,
125 \fB\-h\fR
126 and
127 \fB\-f\fR
128 options are only used when
129 \fBlogin\fR
130 is invoked by root\&.
131 .SH "CAVEATS"
132 .PP
133 This version of
134 \fBlogin\fR
135 has many compilation options, only some of which may be in use at any particular site\&.
136 .PP
137 The location of files is subject to differences in system configuration\&.
138 .PP
139 The
140 \fBlogin\fR
141 program is NOT responsible for removing users from the utmp file\&. It is the responsibility of
142 \fBgetty\fR(8)
143 and
144 \fBinit\fR(8)
145 to clean up apparent ownership of a terminal session\&. If you use
146 \fBlogin\fR
147 from the shell prompt without
148 \fBexec\fR, the user you use will continue to appear to be logged in even after you log out of the "subsession"\&.
149 .PP
150 As with any program,
151 \fBlogin\fR\*(Aqs appearance can be faked\&. If non\-trusted users have physical access to a machine, an attacker could use this to obtain the password of the next person coming to sit in front of the machine\&. Under Linux, the SAK mechanism can be used by users to initiate a trusted path and prevent this kind of attack\&.
152 .SH "CONFIGURATION"
153 .PP
154 The following configuration variables in
155 /etc/login\&.defs
156 change the behavior of this tool:
157 .PP
158 \fBCONSOLE\fR (string)
159 .RS 4
160 If defined, either full pathname of a file containing device names (one per line) or a ":" delimited list of device names\&. Root logins will be allowed only upon these devices\&.
161 .sp
162 If not defined, root will be allowed on any device\&.
163 .sp
164 The device should be specified without the /dev/ prefix\&.
165 .RE
166 .PP
167 \fBCONSOLE_GROUPS\fR (string)
168 .RS 4
169 List of groups to add to the user\*(Aqs supplementary groups set when logging in on the console (as determined by the CONSOLE setting)\&. Default is none\&.
170
171 Use with caution \- it is possible for users to gain permanent access to these groups, even when not logged in on the console\&.
172 .RE
173 .PP
174 \fBDEFAULT_HOME\fR (boolean)
175 .RS 4
176 Indicate if login is allowed if we can\*(Aqt cd to the home directory\&. Default in no\&.
177 .sp
178 If set to
179 \fIyes\fR, the user will login in the root (/) directory if it is not possible to cd to her home directory\&.
180 .RE
181 .PP
182 \fBENV_HZ\fR (string)
183 .RS 4
184 If set, it will be used to define the HZ environment variable when a user login\&. The value must be preceded by
185 \fIHZ=\fR\&. A common value on Linux is
186 \fIHZ=100\fR\&.
187 .RE
188 .PP
189 \fBENV_PATH\fR (string)
190 .RS 4
191 If set, it will be used to define the PATH environment variable when a regular user login\&. The value can be preceded by
192 \fIPATH=\fR, or a colon separated list of paths (for example
193 \fI/bin:/usr/bin\fR)\&. The default value is
194 \fIPATH=/bin:/usr/bin\fR\&.
195 .RE
196 .PP
197 \fBENV_SUPATH\fR (string)
198 .RS 4
199 If set, it will be used to define the PATH environment variable when the superuser login\&. The value can be preceded by
200 \fIPATH=\fR, or a colon separated list of paths (for example
201 \fI/sbin:/bin:/usr/sbin:/usr/bin\fR)\&. The default value is
202 \fIPATH=/bin:/usr/bin\fR\&.
203 .RE
204 .PP
205 \fBENV_TZ\fR (string)
206 .RS 4
207 If set, it will be used to define the TZ environment variable when a user login\&. The value can be the name of a timezone preceded by
208 \fITZ=\fR
209 (for example
210 \fITZ=CST6CDT\fR), or the full path to the file containing the timezone specification (for example
211 /etc/tzname)\&.
212 .sp
213 If a full path is specified but the file does not exist or cannot be read, the default is to use
214 \fITZ=CST6CDT\fR\&.
215 .RE
216 .PP
217 \fBENVIRON_FILE\fR (string)
218 .RS 4
219 If this file exists and is readable, login environment will be read from it\&. Every line should be in the form name=value\&.
220 .sp
221 Lines starting with a # are treated as comment lines and ignored\&.
222 .RE
223 .PP
224 \fBERASECHAR\fR (number)
225 .RS 4
226 Terminal ERASE character (\fI010\fR
227 = backspace,
228 \fI0177\fR
229 = DEL)\&.
230 .sp
231 The value can be prefixed "0" for an octal value, or "0x" for an hexadecimal value\&.
232 .RE
233 .PP
234 \fBFAIL_DELAY\fR (number)
235 .RS 4
236 Delay in seconds before being allowed another attempt after a login failure\&.
237 .RE
238 .PP
239 \fBFAILLOG_ENAB\fR (boolean)
240 .RS 4
241 Enable logging and display of
242 /var/log/faillog
243 login failure info\&.
244 .RE
245 .PP
246 \fBFAKE_SHELL\fR (string)
247 .RS 4
248 If set,
249 \fBlogin\fR
250 will execute this shell instead of the users\*(Aq shell specified in
251 /etc/passwd\&.
252 .RE
253 .PP
254 \fBFTMP_FILE\fR (string)
255 .RS 4
256 If defined, login failures will be logged in this file in a utmp format\&.
257 .RE
258 .PP
259 \fBHUSHLOGIN_FILE\fR (string)
260 .RS 4
261 If defined, this file can inhibit all the usual chatter during the login sequence\&. If a full pathname is specified, then hushed mode will be enabled if the user\*(Aqs name or shell are found in the file\&. If not a full pathname, then hushed mode will be enabled if the file exists in the user\*(Aqs home directory\&.
262 .RE
263 .PP
264 \fBISSUE_FILE\fR (string)
265 .RS 4
266 If defined, this file will be displayed before each login prompt\&.
267 .RE
268 .PP
269 \fBKILLCHAR\fR (number)
270 .RS 4
271 Terminal KILL character (\fI025\fR
272 = CTRL/U)\&.
273 .sp
274 The value can be prefixed "0" for an octal value, or "0x" for an hexadecimal value\&.
275 .RE
276 .PP
277 \fBLASTLOG_ENAB\fR (boolean)
278 .RS 4
279 Enable logging and display of /var/log/lastlog login time info\&.
280 .RE
281 .PP
282 \fBLOGIN_RETRIES\fR (number)
283 .RS 4
284 Maximum number of login retries in case of bad password\&.
285 .RE
286 .PP
287 \fBLOGIN_STRING\fR (string)
288 .RS 4
289 The string used for prompting a password\&. The default is to use "Password: ", or a translation of that string\&. If you set this variable, the prompt will no be translated\&.
290 .sp
291 If the string contains
292 \fI%s\fR, this will be replaced by the user\*(Aqs name\&.
293 .RE
294 .PP
295 \fBLOGIN_TIMEOUT\fR (number)
296 .RS 4
297 Max time in seconds for login\&.
298 .RE
299 .PP
300 \fBLOG_OK_LOGINS\fR (boolean)
301 .RS 4
302 Enable logging of successful logins\&.
303 .RE
304 .PP
305 \fBLOG_UNKFAIL_ENAB\fR (boolean)
306 .RS 4
307 Enable display of unknown usernames when login failures are recorded\&.
308 .sp
309 Note: logging unknown usernames may be a security issue if an user enter her password instead of her login name\&.
310 .RE
311 .PP
312 \fBMAIL_CHECK_ENAB\fR (boolean)
313 .RS 4
314 Enable checking and display of mailbox status upon login\&.
315 .sp
316 You should disable it if the shell startup files already check for mail ("mailx \-e" or equivalent)\&.
317 .RE
318 .PP
319 \fBMAIL_DIR\fR (string)
320 .RS 4
321 The mail spool directory\&. This is needed to manipulate the mailbox when its corresponding user account is modified or deleted\&. If not specified, a compile\-time default is used\&.
322 .RE
323 .PP
324 \fBMAIL_FILE\fR (string)
325 .RS 4
326 Defines the location of the users mail spool files relatively to their home directory\&.
327 .RE
328 .PP
329 The
330 \fBMAIL_DIR\fR
331 and
332 \fBMAIL_FILE\fR
333 variables are used by
334 \fBuseradd\fR,
335 \fBusermod\fR, and
336 \fBuserdel\fR
337 to create, move, or delete the user\*(Aqs mail spool\&.
338 .PP
339 If
340 \fBMAIL_CHECK_ENAB\fR
341 is set to
342 \fIyes\fR, they are also used to define the
343 \fBMAIL\fR
344 environment variable\&.
345 .PP
346 \fBMOTD_FILE\fR (string)
347 .RS 4
348 If defined, ":" delimited list of "message of the day" files to be displayed upon login\&.
349 .RE
350 .PP
351 \fBNOLOGINS_FILE\fR (string)
352 .RS 4
353 If defined, name of file whose presence will inhibit non\-root logins\&. The contents of this file should be a message indicating why logins are inhibited\&.
354 .RE
355 .PP
356 \fBPORTTIME_CHECKS_ENAB\fR (boolean)
357 .RS 4
358 Enable checking of time restrictions specified in /etc/porttime\&.
359 .RE
360 .PP
361 \fBQUOTAS_ENAB\fR (boolean)
362 .RS 4
363 Enable setting of ulimit, umask, and niceness from passwd gecos field\&.
364 .RE
365 .PP
366 \fBTTYGROUP\fR (string), \fBTTYPERM\fR (string)
367 .RS 4
368 The terminal permissions: the login tty will be owned by the
369 \fBTTYGROUP\fR
370 group, and the permissions will be set to
371 \fBTTYPERM\fR\&.
372 .sp
373 By default, the ownership of the terminal is set to the user\*(Aqs primary group and the permissions are set to
374 \fI0600\fR\&.
375 .sp
376
377 \fBTTYGROUP\fR
378 can be either the name of a group or a numeric group identifier\&.
379 .sp
380 If you have a
381 \fBwrite\fR
382 program which is "setgid" to a special group which owns the terminals, define TTYGROUP to the group number and TTYPERM to 0620\&. Otherwise leave TTYGROUP commented out and assign TTYPERM to either 622 or 600\&.
383 .RE
384 .PP
385 \fBTTYTYPE_FILE\fR (string)
386 .RS 4
387 If defined, file which maps tty line to TERM environment parameter\&. Each line of the file is in a format something like "vt100 tty01"\&.
388 .RE
389 .PP
390 \fBULIMIT\fR (number)
391 .RS 4
392 Default
393 \fBulimit\fR
394 value\&.
395 .RE
396 .PP
397 \fBUMASK\fR (number)
398 .RS 4
399 The file mode creation mask is initialized to this value\&. If not specified, the mask will be initialized to 022\&.
400 .sp
401
402 \fBuseradd\fR
403 and
404 \fBnewusers\fR
405 use this mask to set the mode of the home directory they create
406 .sp
407 It is also used by
408 \fBlogin\fR
409 to define users\*(Aq initial umask\&. Note that this mask can be overriden by the user\*(Aqs GECOS line (if
410 \fBQUOTAS_ENAB\fR
411 is set) or by the specification of a limit with the
412 \fIK\fR
413 identifier in
414 \fBlimits\fR(5)\&.
415 .RE
416 .PP
417 \fBUSERGROUPS_ENAB\fR (boolean)
418 .RS 4
419 Enable setting of the umask group bits to be the same as owner bits (examples: 022 \-> 002, 077 \-> 007) for non\-root users, if the uid is the same as gid, and username is the same as the primary group name\&.
420 .sp
421 If set to
422 \fIyes\fR,
423 \fBuserdel\fR
424 will remove the user\*(Aqs group if it contains no more members, and
425 \fBuseradd\fR
426 will create by default a group with the name of the user\&.
427 .RE
428 .SH "FILES"
429 .PP
430 /var/run/utmp
431 .RS 4
432 List of current login sessions\&.
433 .RE
434 .PP
435 /var/log/wtmp
436 .RS 4
437 List of previous login sessions\&.
438 .RE
439 .PP
440 /etc/passwd
441 .RS 4
442 User account information\&.
443 .RE
444 .PP
445 /etc/shadow
446 .RS 4
447 Secure user account information\&.
448 .RE
449 .PP
450 /etc/motd
451 .RS 4
452 System message of the day file\&.
453 .RE
454 .PP
455 /etc/nologin
456 .RS 4
457 Prevent non\-root users from logging in\&.
458 .RE
459 .PP
460 /etc/ttytype
461 .RS 4
462 List of terminal types\&.
463 .RE
464 .PP
465 $HOME/\&.hushlogin
466 .RS 4
467 Suppress printing of system messages\&.
468 .RE
469 .PP
470 /etc/login\&.defs
471 .RS 4
472 Shadow password suite configuration\&.
473 .RE
474 .SH "SEE ALSO"
475 .PP
476
477 \fBmail\fR(1),
478 \fBpasswd\fR(1),
479 \fBsh\fR(1),
480 \fBsu\fR(1),
481 \fBlogin.defs\fR(5),
482 \fBnologin\fR(5),
483 \fBpasswd\fR(5),
484 \fBsecuretty\fR(5),
485 \fBgetty\fR(8)\&.