]> git.ipfire.org Git - thirdparty/util-linux.git/blob - term-utils/agetty.8
Merge branch 'master' of https://github.com/eric-s-raymond/util-linux
[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 \fIinit(8)\fP.
17
18 \fBagetty\fP has several \fInon-standard\fP features that are useful
19 for hard-wired 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 back space (erase); carriage return and line feed (end of line).
27 See also \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 hard-ware 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 virtual terminal, or 'hurd'
81 for GNU Hurd on 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 behaviour 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 \fItermios(3)\fP for more
100 details.
101 .TP
102 \-E, \-\-remote
103 If \-H \fIfakehost\fP option is given then \-r \fIfakehost\fP options is
104 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 .PP
135 .TP
136 \-l, \-\-login\-program \fIlogin_program\fP
137 Invoke the specified \fIlogin_program\fP instead of /bin/login.
138 This allows the use of a non-standard login program (for example,
139 one that asks for a dial-up password or that uses a different
140 password file).
141 .TP
142 \-L, \-\-local\-line [=\fImode\fP]
143 Control CLOCAL line flag, the optional argument \fImode\fP is 'auto', 'always' or 'never'.
144 If the \fImode\fP argument is omitted then the default is 'always'. If the
145 \-\-local\-line option is ommitted at all then the default is 'auto'.
146
147 The \fImode\fP 'always' forces the line to be a local line with no need for carrier detect. This can
148 be useful when you have a locally attached terminal where the serial line
149 does not set the carrier detect signal.
150
151 The \fImode\fP 'never' explicitly clears CLOCAL flags from line setting and
152 the carrier detect signal is expected on the line.
153
154 The \fImode\fP 'auto' (agetty default) does not modify CLOCAL setting
155 and follows the setting enabled by kernel.
156 .TP
157 \-m, \-\-extract\-baud
158 Try to extract the baud rate the CONNECT status message
159 produced by Hayes(tm)\-compatible modems. These status
160 messages are of the form: "<junk><speed><junk>".
161 \fBagetty\fP assumes that the modem emits its status message at
162 the same speed as specified with (the first) \fIbaud_rate\fP value
163 on the command line.
164 .sp
165 Since the \fI\-m\fP feature may fail on heavily-loaded systems,
166 you still should enable BREAK processing by enumerating all
167 expected baud rates on the command line.
168 .TP
169 \-n, \-\-skip\-login
170 Do not prompt the user for a login name. This can be used in
171 connection with \-l option to invoke a non-standard login process such
172 as a BBS system. Note that with the \-n option, \fBagetty\fR gets no input from
173 user who logs in and therefore won't be able to figure out parity,
174 character size, and newline processing of the connection. It defaults to
175 space parity, 7 bit characters, and ASCII CR (13) end-of-line character.
176 Beware that the program that \fBagetty\fR starts (usually /bin/login)
177 is run as root.
178 .TP
179 \-o, \-\-login\-options \fI"login_options"\fP
180 Options that are passed to the login program. \\u is replaced
181 by the login name. The default \fB/bin/login\fP command line
182 is "/bin/login -- <username>".
183
184 Please read the SECURITY NOTICE below if you want to use this.
185 .TP
186 \-p, \-\-login\-pause
187 Wait for any key before dropping to the login prompt. Can be combined
188 with \fB\-\-autologin\fP to save memory by lazily spawning shells.
189 .TP
190 \-r, \-\-chroot \fI"directory"\fP
191 Change root to the specified directory.
192 .TP
193 \-R, \-\-hangup
194 Do call vhangup() for a virtually hangup of the specified terminal.
195 .TP
196 \-s, \-\-keep\-baud
197 Try to keep the existing baud rate. The baud rates from
198 the command line are used when agetty receives a BREAK character.
199 .TP
200 \-t, \-\-timeout \fItimeout\fP
201 Terminate if no user name could be read within \fItimeout\fP
202 seconds. This option should probably not be used with hard-wired
203 lines.
204 .TP
205 \-U, \-\-detect\-case
206 Turn on support for detecting an uppercase only terminal. This setting will
207 detect a login name containing only capitals as indicating an uppercase
208 only terminal and turn on some upper to lower case conversions. Note that
209 this has no support for any unicode characters.
210 .TP
211 \-w, \-\-wait\-cr
212 Wait for the user or the modem to send a carriage-return or a
213 linefeed character before sending the \fI/etc/issue\fP (or other) file
214 and the login prompt. Very useful in connection with the \-I option.
215 .TP
216 \-\-noclear
217 Do not clear the screen before prompting for the login name
218 (the screen is normally cleared).
219 .TP
220 \-\-nohints
221 Do not print hints about Num, Caps and Scroll Locks.
222 .TP
223 \-\-nonewline
224 Do not print a newline before writing out /etc/issue.
225 .TP
226 \-\-nohostname
227 By default the hostname will be printed. With this option enabled,
228 no hostname at all will be shown.
229 .TP
230 \-\-long\-hostname
231 By default the hostname is only printed until the first dot. With
232 this option enabled, the full qualified hostname by gethostname()
233 or if not found by getaddrinfo() is shown.
234 .TP
235 \-\-erase\-chars \fIstring\fP
236 This option specifies additional chars that should be interpreted as a
237 backspace (ignore previous char) when user specifies login name. The original
238 default has been \'#\', since util-linux 2.23 no additional erase chars are
239 enabled by default.
240 .TP
241 \-\-kill\-chars \fIstring\fP
242 This option specifies additional chars that should be interpreted as a
243 kill (ignore all previous chars) when user specifies login name. The original
244 default has been \'@\', since util-linux 2.23 no additional erase chars are
245 enabled by default.
246 .TP
247 \-\-version
248 Output version information and exit.
249 .TP
250 \-\-help
251 Output help screen and exit.
252 .PP
253 .SH EXAMPLES
254 This section shows examples for the process field of an entry in the
255 \fI/etc/inittab\fP file. You'll have to prepend appropriate values
256 for the other fields. See \fIinittab(5)\fP for more details.
257
258 For a hard-wired line or a console tty:
259
260 .RS
261 /sbin/agetty 9600 ttyS1
262 .RE
263
264 For a directly connected terminal without proper carriage detect wiring:
265 (try this if your terminal just sleeps instead of giving you a password:
266 prompt.)
267
268 .RS
269 /sbin/agetty \-L 9600 ttyS1 vt100
270 .RE
271
272 For a old style dial-in line with a 9600/2400/1200 baud modem:
273
274 .RS
275 /sbin/agetty \-mt60 ttyS1 9600,2400,1200
276 .RE
277
278 For a Hayes modem with a fixed 115200 bps interface to the machine:
279 (the example init string turns off modem echo and result codes, makes
280 modem/computer DCD track modem/modem DCD, makes a DTR drop cause a
281 dis-connection and turn on auto-answer after 1 ring.)
282
283 .RS
284 /sbin/agetty \-w \-I 'ATE0Q1&D2&C1S0=1\\015' 115200 ttyS1
285 .RE
286
287 .SH SECURITY NOTICE
288 If you use the \fB\-\-login\-program\fP and \fB\-\-login\-options\fP options,
289 be aware that a malicious user may try to enter lognames with embedded options,
290 which then get passed to the used login program. Agetty does check
291 for a leading "\-" and makes sure the logname gets passed as one parameter
292 (so embedded spaces will not create yet another parameter), but depending
293 on how the login binary parses the command line that might not be sufficient.
294 Check that the used login program can not be abused this way.
295 .PP
296 Some programs use "\-\-" to indicate that the rest of the commandline should
297 not be interpreted as options. Use this feature if available by passing "\-\-"
298 before the username gets passed by \\u.
299
300 .SH ISSUE ESCAPES
301 The issue-file (\fI/etc/issue\fP or the file set with the \-f option)
302 may contain certain escape codes to display the system name, date and
303 time etc. All escape codes consist of a backslash (\\) immediately
304 followed by one of the letters explained below.
305
306 .TP
307 4 or 4{interface}
308 Insert the IPv4 address of the machine hostname or IPv4 address the configured
309 network interface if the interface argument is specified (e.g. \\4{eth0}).
310 .TP
311 6 or 6{interface}
312 Insert the IPv6 address of the machine hostname or IPv6 address the configured
313 network interface if the interface argument is specified (e.g. \\6{eth0}}
314 .TP
315 b
316 Insert the baudrate of the current line.
317 .TP
318 d
319 Insert the current date.
320 .TP
321 s
322 Insert the system name, the name of the operating system. Same as `uname \-s'.
323 .TP
324 l
325 Insert the name of the current tty line.
326 .TP
327 m
328 Insert the architecture identifier of the machine. Same as `uname \-m'.
329 .TP
330 n
331 Insert the nodename of the machine, also known as the hostname. Same as `uname \-n'.
332 .TP
333 o
334 Insert the NIS domainname of the machine. Same as `hostname \-d'.
335 .TP
336 O
337 Insert the DNS domainname of the machine.
338 .TP
339 r
340 Insert the release number of the OS. Same as `uname \-r'.
341 .TP
342 t
343 Insert the current time.
344 .TP
345 u
346 Insert the number of current users logged in.
347 .TP
348 U
349 Insert the string "1 user" or "<n> users" where <n> is the number of current
350 users logged in.
351 .PP
352 v
353 Insert the version of the OS, eg. the build-date etc.
354 .PP
355 Example: On my system, the following \fI/etc/issue\fP file:
356 .sp
357 .na
358 .RS
359 .nf
360 This is \\n.\\o (\\s \\m \\r) \\t
361 .fi
362 .RE
363 .PP
364 displays as
365 .sp
366 .RS
367 .nf
368 This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30
369 .fi
370 .RE
371
372 .SH FILES
373 .na
374 .TP
375 .B /var/run/utmp
376 the system status file.
377 .TP
378 .B /etc/issue
379 printed before the login prompt.
380 .TP
381 .B /dev/console
382 problem reports (if syslog(3) is not used).
383 .TP
384 .B /etc/inittab
385 \fIinit\fP(8) configuration file.
386 .SH BUGS
387 .ad
388 .fi
389 The baud-rate detection feature (the \fI\-m\fP option) requires that
390 \fBagetty\fP be scheduled soon enough after completion of a dial-in
391 call (within 30 ms with modems that talk at 2400 baud). For robustness,
392 always use the \fI\-m\fP option in combination with a multiple baud
393 rate command-line argument, so that BREAK processing is enabled.
394
395 The text in the \fI/etc/issue\fP file (or other) and the login prompt
396 are always output with 7-bit characters and space parity.
397
398 The baud-rate detection feature (the \fI\-m\fP option) requires that
399 the modem emits its status message \fIafter\fP raising the DCD line.
400 .SH DIAGNOSTICS
401 .ad
402 .fi
403 Depending on how the program was configured, all diagnostics are
404 written to the console device or reported via the syslog(3) facility.
405 Error messages are produced if the \fIport\fP argument does not
406 specify a terminal device; if there is no utmp entry for the
407 current process (System V only); and so on.
408 .SH AUTHORS
409 .UR werner@suse.de
410 Werner Fink
411 .UE
412 .br
413 .UR kzak@redhat.com
414 Karel Zak
415 .UE
416 .sp
417 The original
418 .B agetty
419 for serial terminals was written by W.Z. Venema <wietse@wzv.win.tue.nl>
420 and ported to Linux by Peter Orbaek <poe@daimi.aau.dk>.
421
422 .SH AVAILABILITY
423 The agetty command is part of the util-linux package and is available from
424 ftp://ftp.kernel.org/pub/linux/utils/util\-linux/.