]> git.ipfire.org Git - thirdparty/util-linux.git/blob - term-utils/agetty.8
docs: fix "behaviour" vs. "behavior"
[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 .RB [ options ]
8 .I port
9 .RI [ baud_rate ...]
10 .RI [ term ]
11
12 .SH DESCRIPTION
13 .ad
14 .fi
15 \fBagetty\fP opens a tty port, prompts for a login name and invokes
16 the /bin/login command. It is normally invoked by \fBinit\fP(8).
17
18 \fBagetty\fP has several \fInon-standard\fP features that are useful
19 for hardwired and for dial-in lines:
20 .IP \(bu
21 Adapts the tty settings to parity bits and to erase, kill,
22 end-of-line and uppercase characters when it reads a login name.
23 The program can handle 7-bit characters with even, odd, none or space
24 parity, and 8-bit characters with no parity. The following special
25 characters are recognized: Control-U (kill); DEL and
26 backspace (erase); carriage return and line feed (end of line).
27 See also the \fB\-\-erase-chars\fP and \fB\-\-kill-chars\fP options.
28 .IP \(bu
29 Optionally deduces the baud rate from the CONNECT messages produced by
30 Hayes(tm)-compatible modems.
31 .IP \(bu
32 Optionally does not hang up when it is given an already opened line
33 (useful for call-back applications).
34 .IP \(bu
35 Optionally does not display the contents of the \fI/etc/issue\fP file.
36 .IP \(bu
37 Optionally displays an alternative issue file instead of \fI/etc/issue\fP.
38 .IP \(bu
39 Optionally does not ask for a login name.
40 .IP \(bu
41 Optionally invokes a non-standard login program instead of
42 \fI/bin/login\fP.
43 .IP \(bu
44 Optionally turns on hardware flow control
45 .IP \(bu
46 Optionally forces the line to be local with no need for carrier detect.
47 .PP
48 This program does not use the \fI/etc/gettydefs\fP (System V) or
49 \fI/etc/gettytab\fP (SunOS 4) files.
50 .SH ARGUMENTS
51 .na
52 .nf
53 .fi
54 .ad
55 .TP
56 port
57 A path name relative to the \fI/dev\fP directory. If a "\-" is
58 specified, \fBagetty\fP assumes that its standard input is
59 already connected to a tty port and that a connection to a
60 remote user has already been established.
61 .sp
62 Under System V, a "\-" \fIport\fP argument should be preceded
63 by a "\-\-".
64 .TP
65 baud_rate,...
66 A comma-separated list of one or more baud rates. Each time
67 \fBagetty\fP receives a BREAK character it advances through
68 the list, which is treated as if it were circular.
69 .sp
70 Baud rates should be specified in descending order, so that the
71 null character (Ctrl\-@) can also be used for baud-rate switching.
72 .sp
73 This argument is optional and unnecessary for virtual terminals.
74 The default for serial terminals is '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 \-\-version
256 Display version information and exit.
257 .TP
258 \-\-help
259 Display help text and exit.
260 .PP
261 .SH EXAMPLES
262 This section shows examples for the process field of an entry in the
263 \fI/etc/inittab\fP file. You'll have to prepend appropriate values
264 for the other fields. See \fIinittab(5)\fP for more details.
265
266 For a hardwired line or a console tty:
267
268 .RS
269 /sbin/agetty 9600 ttyS1
270 .RE
271
272 For a directly connected terminal without proper carrier-detect wiring
273 (try this if your terminal just sleeps instead of giving you a password:
274 prompt):
275
276 .RS
277 /sbin/agetty \-L 9600 ttyS1 vt100
278 .RE
279
280 For an old-style dial-in line with a 9600/2400/1200 baud modem:
281
282 .RS
283 /sbin/agetty \-mt60 ttyS1 9600,2400,1200
284 .RE
285
286 For a Hayes modem with a fixed 115200 bps interface to the machine
287 (the example init string turns off modem echo and result codes, makes
288 modem/computer DCD track modem/modem DCD, makes a DTR drop cause a
289 disconnection, and turns on auto-answer after 1 ring):
290
291 .RS
292 /sbin/agetty \-w \-I 'ATE0Q1&D2&C1S0=1\\015' 115200 ttyS1
293 .RE
294
295 .SH SECURITY NOTICE
296 If you use the \fB\-\-login\-program\fP and \fB\-\-login\-options\fP options,
297 be aware that a malicious user may try to enter lognames with embedded options,
298 which then get passed to the used login program. Agetty does check
299 for a leading "\-" and makes sure the logname gets passed as one parameter
300 (so embedded spaces will not create yet another parameter), but depending
301 on how the login binary parses the command line that might not be sufficient.
302 Check that the used login program can not be abused this way.
303 .PP
304 Some programs use "\-\-" to indicate that the rest of the commandline should
305 not be interpreted as options. Use this feature if available by passing "\-\-"
306 before the username gets passed by \\u.
307
308 .SH ISSUE ESCAPES
309 The issue-file (\fI/etc/issue\fP or the file set with the \fB\-f\fP option)
310 may contain certain escape codes to display the system name, date, time
311 etcetera. All escape codes consist of a backslash (\\) immediately
312 followed by one of the letters explained below.
313
314 .TP
315 4 or 4{interface}
316 Insert the IPv4 address the specified network interface (e.g. \\4{eth0})
317 and if the interface argument is not specified then select the first fully
318 configured (UP, non-LOCALBACK, RUNNING) interface. If not found any
319 configured interface fall back to IP address of the machine hostname.
320 .TP
321 6 or 6{interface}
322 The same as \\4 but for IPv6.
323 .TP
324 b
325 Insert the baudrate of the current line.
326 .TP
327 d
328 Insert the current date.
329 .TP
330 s
331 Insert the system name, the name of the operating system. Same as `uname \-s'.
332 See also \\S escape code.
333 .TP
334 S or S{VARIABLE}
335 Insert the VARIABLE data from \fI/etc/os-release\fP. If the VARIABLE argument
336 is not specified then use PRETTY_NAME from the file or the system name (see \\s).
337 This escape code allows to keep \fI/etc/issue\fP distribution and release
338 independent. Note that \\S{ANSI_COLOR} is converted to the real terminal
339 escape sequence.
340 .TP
341 l
342 Insert the name of the current tty line.
343 .TP
344 m
345 Insert the architecture identifier of the machine. Same as `uname \-m'.
346 .TP
347 n
348 Insert the nodename of the machine, also known as the hostname. Same as `uname \-n'.
349 .TP
350 o
351 Insert the NIS domainname of the machine. Same as `hostname \-d'.
352 .TP
353 O
354 Insert the DNS domainname of the machine.
355 .TP
356 r
357 Insert the release number of the OS. Same as `uname \-r'.
358 .TP
359 t
360 Insert the current time.
361 .TP
362 u
363 Insert the number of current users logged in.
364 .TP
365 U
366 Insert the string "1 user" or "<n> users" where <n> is the number of current
367 users logged in.
368 .TP
369 v
370 Insert the version of the OS, eg. the build-date etc.
371 .PP
372 Example: On my system, the following \fI/etc/issue\fP file:
373 .sp
374 .na
375 .RS
376 .nf
377 This is \\n.\\o (\\s \\m \\r) \\t
378 .fi
379 .RE
380 .PP
381 displays as:
382 .sp
383 .RS
384 .nf
385 This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30
386 .fi
387 .RE
388
389 .SH FILES
390 .na
391 .TP
392 .B /var/run/utmp
393 the system status file.
394 .TP
395 .B /etc/issue
396 printed before the login prompt.
397 .TP
398 .B /etc/os-release
399 operating system identification data.
400 .TP
401 .B /dev/console
402 problem reports (if syslog(3) is not used).
403 .TP
404 .B /etc/inittab
405 \fIinit\fP(8) configuration file for SysV-style init daemon.
406 .SH BUGS
407 .ad
408 .fi
409 The baud-rate detection feature (the \fB\-m\fP option) requires that
410 \fBagetty\fP be scheduled soon enough after completion of a dial-in
411 call (within 30 ms with modems that talk at 2400 baud). For robustness,
412 always use the \fB\-m\fP option in combination with a multiple baud
413 rate command-line argument, so that BREAK processing is enabled.
414
415 The text in the \fI/etc/issue\fP file (or other) and the login prompt
416 are always output with 7-bit characters and space parity.
417
418 The baud-rate detection feature (the \fB\-m\fP option) requires that
419 the modem emits its status message \fIafter\fP raising the DCD line.
420 .SH DIAGNOSTICS
421 .ad
422 .fi
423 Depending on how the program was configured, all diagnostics are
424 written to the console device or reported via the syslog(3) facility.
425 Error messages are produced if the \fIport\fP argument does not
426 specify a terminal device; if there is no utmp entry for the
427 current process (System V only); and so on.
428 .SH AUTHORS
429 .UR werner@suse.de
430 Werner Fink
431 .UE
432 .br
433 .UR kzak@redhat.com
434 Karel Zak
435 .UE
436 .sp
437 The original
438 .B agetty
439 for serial terminals was written by W.Z. Venema <wietse@wzv.win.tue.nl>
440 and ported to Linux by Peter Orbaek <poe@daimi.aau.dk>.
441
442 .SH AVAILABILITY
443 The agetty command is part of the util-linux package and is available from
444 ftp://ftp.kernel.org/pub/linux/utils/util\-linux/.