]> git.ipfire.org Git - thirdparty/util-linux.git/blob - term-utils/agetty.8
libblkid: check status for the current CDROM slot
[thirdparty/util-linux.git] / term-utils / agetty.8
1 .TH AGETTY 8 "February 2016" "util-linux" "System Administration"
2 .SH NAME
3 agetty \- alternative Linux getty
4
5 .SH SYNOPSIS
6 .B agetty
7 [options]
8 .IR port " [" baud_rate "...] [" term ]
9
10 .SH DESCRIPTION
11 .ad
12 .fi
13 \fBagetty\fP opens a tty port, prompts for a login name and invokes
14 the /bin/login command. It is normally invoked by \fBinit\fP(8).
15
16 \fBagetty\fP has several \fInon-standard\fP features that are useful
17 for hardwired and for dial-in lines:
18 .IP \(bu
19 Adapts the tty settings to parity bits and to erase, kill,
20 end-of-line and uppercase characters when it reads a login name.
21 The program can handle 7-bit characters with even, odd, none or space
22 parity, and 8-bit characters with no parity. The following special
23 characters are recognized: Control-U (kill); DEL and
24 backspace (erase); carriage return and line feed (end of line).
25 See also the \fB\-\-erase\-chars\fP and \fB\-\-kill\-chars\fP options.
26 .IP \(bu
27 Optionally deduces the baud rate from the CONNECT messages produced by
28 Hayes(tm)-compatible modems.
29 .IP \(bu
30 Optionally does not hang up when it is given an already opened line
31 (useful for call-back applications).
32 .IP \(bu
33 Optionally does not display the contents of the \fI/etc/issue\fP file.
34 .IP \(bu
35 Optionally displays an alternative issue file or directory instead of \fI/etc/issue\fP or \fI/etc/issue.d\fP.
36 .IP \(bu
37 Optionally does not ask for a login name.
38 .IP \(bu
39 Optionally invokes a non-standard login program instead of
40 \fI/bin/login\fP.
41 .IP \(bu
42 Optionally turns on hardware flow control.
43 .IP \(bu
44 Optionally forces the line to be local with no need for carrier detect.
45 .PP
46 This program does not use the \fI/etc/gettydefs\fP (System V) or
47 \fI/etc/gettytab\fP (SunOS 4) files.
48 .SH ARGUMENTS
49 .na
50 .nf
51 .fi
52 .ad
53 .TP
54 .I port
55 A path name relative to the \fI/dev\fP directory. If a "\-" is
56 specified, \fBagetty\fP assumes that its standard input is
57 already connected to a tty port and that a connection to a
58 remote user has already been established.
59 .sp
60 Under System V, a "\-" \fIport\fP argument should be preceded
61 by a "\-\-".
62 .TP
63 .IR baud_rate ,...
64 A comma-separated list of one or more baud rates. Each time
65 \fBagetty\fP receives a BREAK character it advances through
66 the list, which is treated as if it were circular.
67 .sp
68 Baud rates should be specified in descending order, so that the
69 null character (Ctrl\-@) can also be used for baud-rate switching.
70 .sp
71 This argument is optional and unnecessary for \fBvirtual terminals\fP.
72 .sp
73 The default for \fBserial terminals\fP is keep the current baud rate
74 (see \fB\-\-keep\-baud\fP) and if unsuccessful then default to '9600'.
75 .TP
76 .I term
77 The value to be used for the TERM environment variable. This overrides
78 whatever init(8) may have set, and is inherited by login and the shell.
79 .sp
80 The default is 'vt100', or 'linux' for Linux on a virtual terminal,
81 or 'hurd' for GNU Hurd on a virtual terminal.
82 .SH OPTIONS
83 .na
84 .nf
85 .fi
86 .ad
87 .TP
88 \-8, \-\-8bits
89 Assume that the tty is 8-bit clean, hence disable parity detection.
90 .TP
91 \-a, \-\-autologin \fIusername\fP
92 Automatically log in the specified user without asking for a username or password.
93 Using this option causes an \fB\-f \fIusername\fR option and argument to be
94 added to the \fB/bin/login\fP command line. See \fB\-\-login\-options\fR, which
95 can be used to modify this option's behavior.
96
97 Note that \fB\-\-autologin\fP may affect the way how agetty initializes the
98 serial line, because on auto-login agetty does not read from the line and it
99 has no opportunity optimize the line setting.
100 .TP
101 \-c, \-\-noreset
102 Do not reset terminal cflags (control modes). See \fBtermios\fP(3) for more
103 details.
104 .TP
105 \-E, \-\-remote
106 Typically the \fBlogin\fP(1) command is given a remote hostname when
107 called by something such as \fBtelnetd\fP(8). This option allows \fBagetty\fP
108 to pass what it is using for a hostname to \fBlogin\fP(1) for use
109 in \fButmp\fP(5). See \fB\-\-host\fP, \fBlogin\fP(1), and \fButmp\fP(5).
110 .IP
111 If the \fB\-\-host\fP \fIfakehost\fP option is given, then an \fB\-h\fP
112 \fIfakehost\fP option and argument are added to the \fB/bin/login\fP
113 command line.
114 .IP
115 If the \fB\-\-nohostname\fR option is given, then an \fB\-H\fP option
116 is added to the \fB/bin/login\fP command line.
117 .IP
118 See \fB\-\-login\-options\fR.
119 .TP
120 \-f, \-\-issue\-file \fIfile|directory\fP
121 Display the contents of \fIfile\fP instead of \fI/etc/issue\fP (or other). If the
122 specified path is a \fIdirectory\fP then displays all files with .issue file
123 extension in version-sort order from the directory. This allows custom
124 messages to be displayed on different terminals. The
125 \-\-noissue option will override this option.
126 .TP
127 \-\-show\-issue
128 Display the current issue file (or other) on the current terminal and exit.
129 Use this option to review the current setting, it is not designed for any other
130 purpose. Note that output may use some default or incomplete information as
131 proper output depends on terminal and agetty command line.
132 .TP
133 \-h, \-\-flow\-control
134 Enable hardware (RTS/CTS) flow control. It is left up to the
135 application to disable software (XON/XOFF) flow protocol where
136 appropriate.
137 .TP
138 \-H, \-\-host \fIfakehost\fP
139 Write the specified \fIfakehost\fP into the utmp file. Normally,
140 no login host is given, since \fBagetty\fP is used for local hardwired
141 connections and consoles. However, this option can be useful for
142 identifying terminal concentrators and the like.
143 .TP
144 \-i, \-\-noissue
145 Do not display the contents of \fI/etc/issue\fP (or other) before writing the
146 login prompt. Terminals or communications hardware may become confused
147 when receiving lots of text at the wrong baud rate; dial-up scripts
148 may fail if the login prompt is preceded by too much text.
149 .TP
150 \-I, \-\-init\-string \fIinitstring\fP
151 Set an initial string to be sent to the tty or modem before sending
152 anything else. This may be used to initialize a modem. Non-printable
153 characters may be sent by writing their octal code preceded by a
154 backslash (\\). For example, to send a linefeed character (ASCII 10,
155 octal 012), write \\012.
156 .TP
157 \-J, \-\-noclear
158 Do not clear the screen before prompting for the login name.
159 By default the screen is cleared.
160 .TP
161 \-l, \-\-login\-program \fIlogin_program\fP
162 Invoke the specified \fIlogin_program\fP instead of /bin/login. This allows
163 the use of a non-standard login program. Such a program could, for example,
164 ask for a dial-up password or use a different password file. See
165 \fB\-\-login\-options\fP.
166 .TP
167 \-L, \-\-local\-line[=\fImode\fP]
168 Control the CLOCAL line flag. The optional \fImode\fP argument is 'auto', 'always' or 'never'.
169 If the \fImode\fP argument is omitted, then the default is 'always'. If the
170 \-\-local\-line option is not given at all, then the default is 'auto'.
171 .PP
172 .RS
173 .PD 1
174 .TP
175 \fIalways\fR
176 Forces the line to be a local line with no need for carrier detect. This
177 can be useful when you have a locally attached terminal where the serial
178 line does not set the carrier-detect signal.
179 .TP
180 \fInever\fR
181 Explicitly clears the CLOCAL flag from the line setting and the
182 carrier-detect signal is expected on the line.
183 .TP
184 \fIauto\fR
185 The \fBagetty\fR default. Does not modify the CLOCAL setting and follows
186 the setting enabled by the kernel.
187 .PD
188 .RE
189 .TP
190 \-m, \-\-extract\-baud
191 Try to extract the baud rate from the CONNECT status message
192 produced by Hayes(tm)\-compatible modems. These status
193 messages are of the form: "<junk><speed><junk>".
194 \fBagetty\fP assumes that the modem emits its status message at
195 the same speed as specified with (the first) \fIbaud_rate\fP value
196 on the command line.
197 .sp
198 Since the \fB\-\-extract\-baud\fP feature may fail on heavily-loaded
199 systems, you still should enable BREAK processing by enumerating all
200 expected baud rates on the command line.
201 .TP
202 \-\-list\-speeds
203 Display supported baud rates. These are determined at compilation time.
204 .TP
205 \-n, \-\-skip\-login
206 Do not prompt the user for a login name. This can be used in connection
207 with the \fB\-\-login\-program\fP option to invoke a non-standard login
208 process such as a BBS system. Note that with the \fB\-\-skip\-login\fR
209 option, \fBagetty\fR gets no input from the user who logs in and therefore
210 will not be able to figure out parity, character size, and newline
211 processing of the connection. It defaults to space parity, 7 bit
212 characters, and ASCII CR (13) end-of-line character. Beware that the
213 program that \fBagetty\fR starts (usually /bin/login) is run as root.
214 .TP
215 \-N, \-\-nonewline
216 Do not print a newline before writing out /etc/issue.
217 .TP
218 \-o, \-\-login\-options "\fIlogin_options\fP"
219 Options and arguments that are passed to \fBlogin\fP(1). Where \\u is
220 replaced by the login name. For example:
221 .RS
222 .IP "" 4
223 .B "\-\-login\-options '-h darkstar -- \\\u'"
224 .PP
225 See \fB\-\-autologin\fR, \fB\-\-login\-program\fR and \fB\-\-remote\fR.
226 .PP
227 Please read the SECURITY NOTICE below before using this option.
228 .RE
229 .TP
230 \-p, \-\-login\-pause
231 Wait for any key before dropping to the login prompt. Can be combined
232 with \fB\-\-autologin\fP to save memory by lazily spawning shells.
233 .TP
234 \-r, \-\-chroot \fIdirectory\fP
235 Change root to the specified directory.
236 .TP
237 \-R, \-\-hangup
238 Call vhangup() to do a virtual hangup of the specified terminal.
239 .TP
240 \-s, \-\-keep\-baud
241 Try to keep the existing baud rate. The baud rates from
242 the command line are used when agetty receives a BREAK character.
243 .TP
244 \-t, \-\-timeout \fItimeout\fP
245 Terminate if no user name could be read within \fItimeout\fP seconds.
246 Use of this option with hardwired terminal lines is not recommended.
247 .TP
248 \-U, \-\-detect\-case
249 Turn on support for detecting an uppercase-only terminal. This setting
250 will detect a login name containing only capitals as indicating an
251 uppercase-only terminal and turn on some upper-to-lower case conversions.
252 Note that this has no support for any Unicode characters.
253 .TP
254 \-w, \-\-wait\-cr
255 Wait for the user or the modem to send a carriage-return or a
256 linefeed character before sending the \fI/etc/issue\fP file (or others)
257 and the login prompt. This is useful with the \fB\-\-init\-string\fP
258 option.
259 .TP
260 \-\-nohints
261 Do not print hints about Num, Caps and Scroll Locks.
262 .TP
263 \-\-nohostname
264 By default the hostname will be printed. With this option enabled,
265 no hostname at all will be shown.
266 .TP
267 \-\-long\-hostname
268 By default the hostname is only printed until the first dot. With
269 this option enabled, the fully qualified hostname by \fBgethostname\fR(3P)
270 or (if not found) by \fBgetaddrinfo\fR(3) is shown.
271 .TP
272 \-\-erase\-chars \fIstring\fP
273 This option specifies additional characters that should be interpreted as a
274 backspace ("ignore the previous character") when the user types the login name.
275 The default additional \'erase\' has been \'#\', but since util-linux 2.23
276 no additional erase characters are enabled by default.
277 .TP
278 \-\-kill\-chars \fIstring\fP
279 This option specifies additional characters that should be interpreted as a
280 kill ("ignore all previous characters") when the user types the login name.
281 The default additional \'kill\' has been \'@\', but since util-linux 2.23
282 no additional kill characters are enabled by default.
283 .TP
284 \-\-chdir \fIdirectory\fP
285 Change directory before the login.
286 .TP
287 \-\-delay \fInumber\fP
288 Sleep seconds before open tty.
289 .TP
290 \-\-nice \fInumber\fP
291 Run login with this priority.
292 .TP
293 \-\-reload
294 Ask all running agetty instances to reload and update their displayed prompts,
295 if the user has not yet commenced logging in. After doing so the command will
296 exit. This feature might be unsupported on systems without Linux
297 .BR inotify (7).
298 .TP
299 \-\-version
300 Display version information and exit.
301 .TP
302 \-\-help
303 Display help text and exit.
304 .PP
305 .SH EXAMPLES
306 This section shows examples for the process field of an entry in the
307 \fI/etc/inittab\fP file. You'll have to prepend appropriate values
308 for the other fields. See \fIinittab(5)\fP for more details.
309
310 For a hardwired line or a console tty:
311
312 .RS
313 .B /sbin/agetty\ 9600\ ttyS1
314 .RE
315
316 For a directly connected terminal without proper carrier-detect wiring
317 (try this if your terminal just sleeps instead of giving you a password:
318 prompt):
319
320 .RS
321 .B /sbin/agetty\ \-\-local\-line\ 9600\ ttyS1\ vt100
322 .RE
323
324 For an old-style dial-in line with a 9600/2400/1200 baud modem:
325
326 .RS
327 .B /sbin/agetty\ \-\-extract\-baud\ \-\-timeout\ 60\ ttyS1\ 9600,2400,1200
328 .RE
329
330 For a Hayes modem with a fixed 115200 bps interface to the machine
331 (the example init string turns off modem echo and result codes, makes
332 modem/computer DCD track modem/modem DCD, makes a DTR drop cause a
333 disconnection, and turns on auto-answer after 1 ring):
334
335 .ie n .RS 0
336 .el .RS
337 .B /sbin/agetty\ \-\-wait\-cr\ \-\-init\-string\ 'ATE0Q1&D2&C1S0=1\\015'\ 115200\ ttyS1
338 .RE
339
340 .SH SECURITY NOTICE
341 If you use the \fB\-\-login\-program\fP and \fB\-\-login\-options\fP options,
342 be aware that a malicious user may try to enter lognames with embedded options,
343 which then get passed to the used login program. Agetty does check
344 for a leading "\-" and makes sure the logname gets passed as one parameter
345 (so embedded spaces will not create yet another parameter), but depending
346 on how the login binary parses the command line that might not be sufficient.
347 Check that the used login program cannot be abused this way.
348 .PP
349 Some programs use "\-\-" to indicate that the rest of the command line should
350 not be interpreted as options. Use this feature if available by passing "\-\-"
351 before the username gets passed by \\u.
352
353 .SH ISSUE FILES
354 The default issue file is \fI/etc/issue\fP. If the file exists then agetty also
355 checks for \fI/etc/issue.d\fP directory. The directory is optional extension to
356 the default issue file and content of the directory is printed after
357 \fI/etc/issue\fP content. If the \fI/etc/issue\fP does not exist than the
358 directory is ignored. All files \fBwith .issue extension\fP from the directory are
359 printed in version-sort order. The directory allow to maintain 3rd-party
360 messages independently on the primary system \fI/etc/issue\fP file.
361
362 Since version 2.35 additional locations for issue file and directory are
363 supported. If the default \fI/etc/issue\fP does not exist than agetty checks
364 for \fI/run/issue\fP and \fI/run/issue.d\fP, thereafter for
365 \fI/usr/lib/issue\fP and \fI/usr/lib/issue.d\fP. The directory /etc is
366 expected for host specific configuration, /run is expected for generated stuff
367 and /usr/lib for static distribution maintained configuration.
368
369 The default path maybe overridden by \fB\-\-issue\-file\fP option. In this case
370 specified path has to be file or directory and all the default issue file and
371 directory locations are ignored.
372
373 The issue file feature is possible to completely disable by \fB\-\-noissue\fP option.
374
375 It is possible to review the current issue file by \fBagetty \-\-show\-issue\fP
376 on the current terminal.
377
378 The issue files may contain certain escape codes to display the system name, date, time
379 etcetera. All escape codes consist of a backslash (\\) immediately
380 followed by one of the characters listed below.
381
382 .TP
383 4 or 4{\fIinterface\fR}
384 Insert the IPv4 address of the specified network interface (for example: \\4{eth0}).
385 If the \fIinterface\fR argument is not specified, then select the first fully
386 configured (UP, non-LOCALBACK, RUNNING) interface. If not any configured
387 interface is found, fall back to the IP address of the machine's hostname.
388 .TP
389 6 or 6{\fIinterface\fR}
390 The same as \\4 but for IPv6.
391 .TP
392 b
393 Insert the baudrate of the current line.
394 .TP
395 d
396 Insert the current date.
397 .TP
398 e or e{\fIname\fR}
399 Translate the human-readable \fIname\fP to an escape sequence and insert it
400 (for example: \\e{red}Alert text.\\e{reset}). If the \fIname\fR argument is
401 not specified, then insert \\033. The currently supported names are: black,
402 blink, blue, bold, brown, cyan,
403 darkgray, gray, green, halfbright, lightblue, lightcyan, lightgray, lightgreen,
404 lightmagenta, lightred, magenta, red, reset, reverse, and yellow. All unknown
405 names are silently ignored.
406 .TP
407 s
408 Insert the system name (the name of the operating system). Same as 'uname \-s'.
409 See also the \\S escape code.
410 .TP
411 S or S{VARIABLE}
412 Insert the VARIABLE data from \fI/etc/os-release\fP. If this file does not exist
413 then fall back to \fI/usr/lib/os-release\fP. If the VARIABLE argument is not
414 specified, then use PRETTY_NAME from the file or the system name (see \\s).
415 This escape code allows to keep \fI/etc/issue\fP distribution and release
416 independent. Note that \\S{ANSI_COLOR} is converted to the real terminal
417 escape sequence.
418 .TP
419 l
420 Insert the name of the current tty line.
421 .TP
422 m
423 Insert the architecture identifier of the machine. Same as 'uname \-m'.
424 .TP
425 n
426 Insert the nodename of the machine, also known as the hostname. Same as 'uname \-n'.
427 .TP
428 o
429 Insert the NIS domainname of the machine. Same as 'hostname \-d'.
430 .TP
431 O
432 Insert the DNS domainname of the machine.
433 .TP
434 r
435 Insert the release number of the OS. Same as 'uname \-r'.
436 .TP
437 t
438 Insert the current time.
439 .TP
440 u
441 Insert the number of current users logged in.
442 .TP
443 U
444 Insert the string "1 user" or "<n> users" where <n> is the number of current
445 users logged in.
446 .TP
447 v
448 Insert the version of the OS, that is, the build-date and such.
449 .PP
450 An example. On my system, the following \fI/etc/issue\fP file:
451 .sp
452 .na
453 .RS
454 .nf
455 This is \\n.\\o (\\s \\m \\r) \\t
456 .fi
457 .RE
458 .PP
459 displays as:
460 .sp
461 .RS
462 .nf
463 This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30
464 .fi
465 .RE
466
467 .SH FILES
468 .na
469 .TP
470 .I /var/run/utmp
471 the system status file.
472 .TP
473 .I /etc/issue
474 printed before the login prompt.
475 .TP
476 .I /etc/os-release /usr/lib/os-release
477 operating system identification data.
478 .TP
479 .I /dev/console
480 problem reports (if syslog(3) is not used).
481 .TP
482 .I /etc/inittab
483 \fIinit\fP(8) configuration file for SysV-style init daemon.
484 .SH BUGS
485 .ad
486 .fi
487 The baud-rate detection feature (the \fB\-\-extract\-baud\fP option) requires that
488 \fBagetty\fP be scheduled soon enough after completion of a dial-in
489 call (within 30 ms with modems that talk at 2400 baud). For robustness,
490 always use the \fB\-\-extract\-baud\fP option in combination with a multiple baud
491 rate command-line argument, so that BREAK processing is enabled.
492
493 The text in the \fI/etc/issue\fP file (or other) and the login prompt
494 are always output with 7-bit characters and space parity.
495
496 The baud-rate detection feature (the \fB\-\-extract\-baud\fP option) requires that
497 the modem emits its status message \fIafter\fP raising the DCD line.
498 .SH DIAGNOSTICS
499 .ad
500 .fi
501 Depending on how the program was configured, all diagnostics are
502 written to the console device or reported via the \fBsyslog\fR(3) facility.
503 Error messages are produced if the \fIport\fP argument does not
504 specify a terminal device; if there is no utmp entry for the
505 current process (System V only); and so on.
506 .SH AUTHORS
507 .UR werner@suse.de
508 Werner Fink
509 .UE
510 .br
511 .UR kzak@redhat.com
512 Karel Zak
513 .UE
514 .sp
515 The original
516 .B agetty
517 for serial terminals was written by W.Z. Venema <wietse@wzv.win.tue.nl>
518 and ported to Linux by Peter Orbaek <poe@daimi.aau.dk>.
519
520 .SH AVAILABILITY
521 The agetty command is part of the util-linux package and is available from
522 https://www.kernel.org/pub/linux/utils/util\-linux/.