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