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