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 hard-wired
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 following
24 special characters are recognized: Control-U (kill); DEL and
25 back space (erase); carriage return and line feed (end of line).
26 See also --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 file instead of
37 /etc/issue.
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 hard-ware 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 The default for serial terminals is '9600'.
72
73 term The value to be used for the TERM environment variable. This
74 overrides whatever init(8) may have set, and is inherited by
75 login and the shell.
76
77 The default is 'vt100', or 'linux' for Linux on virtual termi‐
78 nal, or 'hurd' for GNU Hurd on virtual terminal.
79
81 -8, --8bits
82 Assume that the tty is 8-bit clean, hence disable parity detec‐
83 tion.
84
85 -a, --autologin username
86 Log the specified user automatically in without asking for a
87 login name and password. The -f username option is added to the
88 /bin/login command line by default. The --login-options option
89 changes this default behaviour and then only \u is replaced by
90 the username and no other option is added to the login command
91 line.
92
93 Note that --autologin may affect the way how agetty initializes
94 the serial line, because on auto-login agetty does not read from
95 the line and it has no opportunity optimize the line setting.
96
97 -c, --noreset
98 Don't reset terminal cflags (control modes). See termios(3) for
99 more details.
100
101 -E, --remote
102 If -H fakehost option is given then -r fakehost options is added
103 to the /bin/login command line.
104
105 -f, --issue-file issue_file
106 Display the contents of issue_file instead of /etc/issue. This
107 allows custom messages to be displayed on different terminals.
108 The -i option will override this option.
109
110 -h, --flow-control
111 Enable hardware (RTS/CTS) flow control. It is left up to the
112 application to disable software (XON/XOFF) flow protocol where
113 appropriate.
114
115 -H, --host login_host
116 Write the specified login_host into the utmp file. (Normally, no
117 login host is given, since agetty is used for local hardwired
118 connections and consoles. However, this option can be useful for
119 identifying terminal concentrators and the like.
120
121 -i, --noissue
122 Do not display the contents of /etc/issue (or other) before
123 writing the login prompt. Terminals or communications hardware
124 may become confused when receiving lots of text at the wrong
125 baud rate; dial-up scripts may fail if the login prompt is pre‐
126 ceded by too much text.
127
128 -I, --init-string initstring
129 Set an initial string to be sent to the tty or modem before
130 sending anything else. This may be used to initialize a modem.
131 Non printable characters may be sent by writing their octal code
132 preceded by a backslash (\). For example to send a linefeed
133 character (ASCII 10, octal 012) write \012.
134
135 -l, --login-program login_program
136 Invoke the specified login_program instead of /bin/login. This
137 allows the use of a non-standard login program (for example, one
138 that asks for a dial-up password or that uses a different pass‐
139 word file).
140
141 -L, --local-line
142 Force the line to be a local line with no need for carrier
143 detect. This can be useful when you have a locally attached ter‐
144 minal where the serial line does not set the carrier detect sig‐
145 nal.
146
147 -m, --extract-baud
148 Try to extract the baud rate the CONNECT status message produced
149 by Hayes(tm)-compatible modems. These status messages are of the
150 form: "<junk><speed><junk>". agetty assumes that the modem
151 emits its status message at the same speed as specified with
152 (the first) baud_rate value on the command line.
153
154 Since the -m feature may fail on heavily-loaded systems, you
155 still should enable BREAK processing by enumerating all expected
156 baud rates on the command line.
157
158 -n, --skip-login
159 Do not prompt the user for a login name. This can be used in
160 connection with -l option to invoke a non-standard login process
161 such as a BBS system. Note that with the -n option, agetty gets
162 no input from user who logs in and therefore won't be able to
163 figure out parity, character size, and newline processing of the
164 connection. It defaults to space parity, 7 bit characters, and
165 ASCII CR (13) end-of-line character. Beware that the program
166 that agetty starts (usually /bin/login) is run as root.
167
168 -o, --login-options "login_options"
169 Options that are passed to the login program. \u is replaced
170 by the login name. The default /bin/login command line is
171 "/bin/login -- <username>".
172
173 Please read the SECURITY NOTICE below if you want to use this.
174
175 -p, --login-pause
176 Wait for any key before dropping to the login prompt. Can be
177 combined with --autologin to save memory by lazily spawning
178 shells.
179
180 -r, --chroot "directory"
181 Change root to the specified directory.
182
183 -R, --hangup
184 Do call vhangup() for a virtually hangup of the specified termi‐
185 nal.
186
187 -s, --keep-baud
188 Try to keep the existing baud rate. The baud rates from the com‐
189 mand line are used when agetty receives a BREAK character.
190
191 -t, --timeout timeout
192 Terminate if no user name could be read within timeout seconds.
193 This option should probably not be used with hard-wired lines.
194
195 -U, --detect-case
196 Turn on support for detecting an uppercase only terminal. This
197 setting will detect a login name containing only capitals as
198 indicating an uppercase only terminal and turn on some upper to
199 lower case conversions. Note that this has no support for any
200 unicode characters.
201
202 -w, --wait-cr
203 Wait for the user or the modem to send a carriage-return or a
204 linefeed character before sending the /etc/issue (or other) file
205 and the login prompt. Very useful in connection with the -I
206 option.
207
208 --noclear
209 Do not clear the screen before prompting for the login name (the
210 screen is normally cleared).
211
212 --nohints
213 Do not print hints about Num, Caps and Scroll Locks.
214
215 --nonewline
216 Do not print a newline before writing out /etc/issue.
217
218 --nohostname
219 By default the hostname will be printed. With this option
220 enabled, no hostname at all will be shown.
221
222 --long-hostname
223 By default the hostname is only printed until the first dot.
224 With this option enabled, the fully qualified hostname by geth‐
225 ostname() or (if not found) by getaddrinfo() is shown.
226
227 --erase-chars string
228 This option specifies additional characters that should be
229 interpreted as a backspace ("ignore the previous character")
230 when the user types the login name. The default additional
231 ´erase´ has been ´#´, but since util-linux 2.23 no additional
232 erase characters are enabled by default.
233
234 --kill-chars string
235 This option specifies additional characters that should be
236 interpreted as a kill ("ignore all previous characters") when
237 the user types the login name. The default additional ´kill´
238 has been ´@´, but since util-linux 2.23 no additional kill char‐
239 acters are enabled by default.
240
241 --version
242 Display version information and exit.
243
244 --help Display help text and exit.
245
247 This section shows examples for the process field of an entry in the
248 /etc/inittab file. You'll have to prepend appropriate values for the
249 other fields. See inittab(5) for more details.
250
251 For a hard-wired line or a console tty:
252
253 /sbin/agetty 9600 ttyS1
254
255 For a directly connected terminal without proper carriage detect
256 wiring: (try this if your terminal just sleeps instead of giving you a
257 password: prompt.)
258
259 /sbin/agetty -L 9600 ttyS1 vt100
260
261 For a old style dial-in line with a 9600/2400/1200 baud modem:
262
263 /sbin/agetty -mt60 ttyS1 9600,2400,1200
264
265 For a Hayes modem with a fixed 115200 bps interface to the machine:
266 (the example init string turns off modem echo and result codes, makes
267 modem/computer DCD track modem/modem DCD, makes a DTR drop cause a dis-
268 connection and turn on auto-answer after 1 ring.)
269
270 /sbin/agetty -w -I 'ATE0Q1&D2&C1S0=1\015' 115200 ttyS1
271
272
274 If you use the --login-program and --login-options options, be aware
275 that a malicious user may try to enter lognames with embedded options,
276 which then get passed to the used login program. Agetty does check for
277 a leading "-" and makes sure the logname gets passed as one parameter
278 (so embedded spaces will not create yet another parameter), but depend‐
279 ing on how the login binary parses the command line that might not be
280 sufficient. Check that the used login program can not be abused this
281 way.
282
283 Some programs use "--" to indicate that the rest of the commandline
284 should not be interpreted as options. Use this feature if available by
285 passing "--" before the username gets passed by \u.
286
287
289 The issue-file (/etc/issue or the file set with the -f option) may con‐
290 tain certain escape codes to display the system name, date and time
291 etc. All escape codes consist of a backslash (\) immediately followed
292 by one of the letters explained below.
293
294
295 4 or 4{interface}
296 Insert the IPv4 address of the machine hostname or IPv4 address
297 the configured network interface if the interface argument is
298 specified (e.g. \4{eth0}).
299
300 6 or 6{interface}
301 Insert the IPv6 address of the machine hostname or IPv6 address
302 the configured network interface if the interface argument is
303 specified (e.g. \6{eth0}}
304
305 b Insert the baudrate of the current line.
306
307 d Insert the current date.
308
309 s Insert the system name, the name of the operating system. Same
310 as `uname -s'. See also \S escape code.
311
312 S or S{VARIABLE}
313 Insert the VARIABLE data from /etc/os-release. If the VARIABLE
314 argument is not specified then use PRETTY_NAME from the file or
315 the system name (see \s). This escape code allows to keep
316 /etc/issue distribution and release independent. Note that
317 \S{ANSI_COLOR} is converted to the real terminal escape
318 sequence.
319
320 l Insert the name of the current tty line.
321
322 m Insert the architecture identifier of the machine. Same as
323 `uname -m'.
324
325 n Insert the nodename of the machine, also known as the hostname.
326 Same as `uname -n'.
327
328 o Insert the NIS domainname of the machine. Same as `hostname -d'.
329
330 O Insert the DNS domainname of the machine.
331
332 r Insert the release number of the OS. Same as `uname -r'.
333
334 t Insert the current time.
335
336 u Insert the number of current users logged in.
337
338 U Insert the string "1 user" or "<n> users" where <n> is the num‐
339 ber of current users logged in.
340
341 v Insert the version of the OS, eg. the build-date etc.
342
343 Example: On my system, the following /etc/issue file:
344
345 This is \n.\o (\s \m \r) \t
346
347 displays as
348
349 This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30
350
351
353 /var/run/utmp
354 the system status file.
355
356 /etc/issue
357 printed before the login prompt.
358
359 /etc/os-release
360 operating system identification data.
361
362 /dev/console
363 problem reports (if syslog(3) is not used).
364
365 /etc/inittab
366 init(8) configuration file for SysV-style init daemon.
367
369 The baud-rate detection feature (the -m option) requires that agetty be
370 scheduled soon enough after completion of a dial-in call (within 30 ms
371 with modems that talk at 2400 baud). For robustness, always use the -m
372 option in combination with a multiple baud rate command-line argument,
373 so that BREAK processing is enabled.
374
375 The text in the /etc/issue file (or other) and the login prompt are
376 always output with 7-bit characters and space parity.
377
378 The baud-rate detection feature (the -m option) requires that the modem
379 emits its status message after raising the DCD line.
380
382 Depending on how the program was configured, all diagnostics are writ‐
383 ten to the console device or reported via the syslog(3) facility.
384 Error messages are produced if the port argument does not specify a
385 terminal device; if there is no utmp entry for the current process
386 (System V only); and so on.
387
389 Werner Fink ⟨werner@suse.de⟩
390 Karel Zak ⟨kzak@redhat.com⟩
391
392 The original agetty for serial terminals was written by W.Z. Venema
393 <wietse@wzv.win.tue.nl> and ported to Linux by Peter Orbaek
394 <poe@daimi.aau.dk>.
395
396
398 The agetty command is part of the util-linux package and is available
399 from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
400
401
402
403util-linux May 2011 AGETTY(8)