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