]> git.ipfire.org Git - thirdparty/util-linux.git/blob - term-utils/agetty.8
agetty: replace gethostbyname() with getaddrinfo()
[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 .BR "agetty " [\-8chiLmnsUw]
7 .RI "[\-a " user ]
8 .RI "[\-f " issue_file ]
9 .RI "[\-H " login_host ]
10 .RI "[\-I " init ]
11 .RI "[\-l " login_program ]
12 .RI "[\-t " timeout ]
13 .I port
14 .I baud_rate,...
15 .RI [ term ]
16
17 .SH DESCRIPTION
18 .ad
19 .fi
20 \fBagetty\fP opens a tty port, prompts for a login name and invokes
21 the /bin/login command. It is normally invoked by \fIinit(8)\fP.
22
23 \fBagetty\fP has several \fInon-standard\fP features that are useful
24 for hard-wired and for dial-in lines:
25 .IP o
26 Adapts the tty settings to parity bits and to erase, kill,
27 end-of-line and uppercase characters when it reads a login name.
28 The program can handle 7-bit characters with even, odd, none or space
29 parity, and 8-bit characters with no parity. The following special
30 characters are recognized: @ and Control-U (kill); #, DEL and
31 back space (erase); carriage return and line feed (end of line).
32 .IP o
33 Optionally deduces the baud rate from the CONNECT messages produced by
34 Hayes(tm)-compatible modems.
35 .IP o
36 Optionally does not hang up when it is given an already opened line
37 (useful for call-back applications).
38 .IP o
39 Optionally does not display the contents of the \fI/etc/issue\fP file.
40 .IP o
41 Optionally displays an alternative issue file instead of \fI/etc/issue\fP.
42 .IP o
43 Optionally does not ask for a login name.
44 .IP o
45 Optionally invokes a non-standard login program instead of
46 \fI/bin/login\fP.
47 .IP o
48 Optionally turns on hard-ware flow control
49 .IP o
50 Optionally forces the line to be local with no need for carrier detect.
51 .PP
52 This program does not use the \fI/etc/gettydefs\fP (System V) or
53 \fI/etc/gettytab\fP (SunOS 4) files.
54 .SH ARGUMENTS
55 .na
56 .nf
57 .fi
58 .ad
59 .TP
60 port
61 A path name relative to the \fI/dev\fP directory. If a "\-" is
62 specified, \fBagetty\fP assumes that its standard input is
63 already connected to a tty port and that a connection to a
64 remote user has already been established.
65 .sp
66 Under System V, a "\-" \fIport\fP argument should be preceded
67 by a "\-\-".
68 .TP
69 baud_rate,...
70 A comma-separated list of one or more baud rates. Each time
71 \fBagetty\fP receives a BREAK character it advances through
72 the list, which is treated as if it were circular.
73 .sp
74 Baud rates should be specified in descending order, so that the
75 null character (Ctrl\-@) can also be used for baud rate switching.
76 .TP
77 term
78 The value to be used for the TERM environment variable. This overrides
79 whatever init(8) may have set, and is inherited by login and the shell.
80 .SH OPTIONS
81 .na
82 .nf
83 .fi
84 .ad
85 .TP
86 \-8, \-\-8bits
87 Assume that the tty is 8-bit clean, hence disable parity detection.
88 .TP
89 \-a, \-\-autologin \fIusername\fP
90 Log the specified user automatically in without asking for a login name and
91 password. The \-f \fIusername\fP option is added to the \fB/bin/login\fP
92 command line by default. The \-\-login-options option changes this default
93 behaviour and then only \\u is replaced by the \fIusername\fP and no other
94 option is added to the login command line.
95 .TP
96 \-c, \-\-noreset
97 Don't reset terminal cflags (control modes). See \fItermios(3)\fP for more
98 details.
99 .TP
100 \-E, \-\-remote
101 If \-H \fIfakehost\fP option is given then \-r \fIfakehost\fP options is
102 added to the the \fB/bin/login\fP command line.
103 .TP
104 \-f, \-\-issue\-file \fIissue_file\fP
105 Display the contents of \fIissue_file\fP instead of \fI/etc/issue\fP.
106 This allows custom messages to be displayed on different terminals.
107 The \-i option will override this option.
108 .TP
109 \-h, \-\-flow\-control
110 Enable hardware (RTS/CTS) flow control. It is left up to the
111 application to disable software (XON/XOFF) flow protocol where
112 appropriate.
113 .TP
114 \-H, \-\-host \fIlogin_host\fP
115 Write the specified \fIlogin_host\fP into the utmp file. (Normally,
116 no login host is given, since \fBagetty\fP is used for local hardwired
117 connections and consoles. However, this option can be useful for
118 identifying terminal concentrators and the like.
119 .TP
120 \-i, \-\-noissue
121 Do not display the contents of \fI/etc/issue\fP (or other) before writing the
122 login prompt. Terminals or communications hardware may become confused
123 when receiving lots of text at the wrong baud rate; dial-up scripts
124 may fail if the login prompt is preceded by too much text.
125 .TP
126 \-I, \-\-init\-string \fIinitstring\fP
127 Set an initial string to be sent to the tty or modem before sending
128 anything else. This may be used to initialize a modem. Non printable
129 characters may be sent by writing their octal code preceded by a
130 backslash (\\). For example to send a linefeed character (ASCII 10,
131 octal 012) write \\012.
132 .PP
133 .TP
134 \-l, \-\-login\-program \fIlogin_program\fP
135 Invoke the specified \fIlogin_program\fP instead of /bin/login.
136 This allows the use of a non-standard login program (for example,
137 one that asks for a dial-up password or that uses a different
138 password file).
139 .TP
140 \-L, \-\-local\-line
141 Force the line to be a local line with no need for carrier detect. This can
142 be useful when you have a locally attached terminal where the serial line
143 does not set the carrier detect signal.
144 .TP
145 \-m, \-\-extract\-baud
146 Try to extract the baud rate the CONNECT status message
147 produced by Hayes(tm)\-compatible modems. These status
148 messages are of the form: "<junk><speed><junk>".
149 \fBagetty\fP assumes that the modem emits its status message at
150 the same speed as specified with (the first) \fIbaud_rate\fP value
151 on the command line.
152 .sp
153 Since the \fI\-m\fP feature may fail on heavily-loaded systems,
154 you still should enable BREAK processing by enumerating all
155 expected baud rates on the command line.
156 .TP
157 \-n, \-\-skip\-login
158 Do not prompt the user for a login name. This can be used in
159 connection with \-l option to invoke a non-standard login process such
160 as a BBS system. Note that with the \-n option, \fBagetty\fR gets no input from
161 user who logs in and therefore won't be able to figure out parity,
162 character size, and newline processing of the connection. It defaults to
163 space parity, 7 bit characters, and ASCII CR (13) end-of-line character.
164 Beware that the program that \fBagetty\fR starts (usually /bin/login)
165 is run as root.
166 .TP
167 \-o, \-\-login\-options \fI"login_options"\fP
168 Options that are passed to the login program. \\u is replaced
169 by the login name. The default \fB/bin/login\fP command line
170 is "/bin/login -- <username>".
171
172 Please read the SECURITY NOTICE below if you want to use this.
173 .TP
174 \-p, \-\-login\-pause
175 Wait for any key before dropping to the login prompt. Can be combined
176 with \fB\-\-autologin\fP to save memory by lazily spawning shells.
177 .TP
178 \-R, \-\-hangup
179 Do call vhangup() for a virtually hangup of the specified terminal.
180 .TP
181 \-s, \-\-keep\-baud
182 Try to keep the existing baud rate. The baud rates from
183 the command line are used when agetty receives a BREAK character.
184 .TP
185 \-t, \-\-timeout \fItimeout\fP
186 Terminate if no user name could be read within \fItimeout\fP
187 seconds. This option should probably not be used with hard-wired
188 lines.
189 .TP
190 \-U, \-\-detect\-case
191 Turn on support for detecting an uppercase only terminal. This setting will
192 detect a login name containing only capitals as indicating an uppercase
193 only terminal and turn on some upper to lower case conversions. Note that
194 this has no support for any unicode characters.
195 .TP
196 \-w, \-\-wait\-cr
197 Wait for the user or the modem to send a carriage-return or a
198 linefeed character before sending the \fI/etc/issue\fP (or other) file
199 and the login prompt. Very useful in connection with the \-I option.
200 .TP
201 \-\-noclear
202 Do not clear the screen before prompting for the login name
203 (the screen is normally cleared).
204 .TP
205 \-\-nohints
206 Do not print hints about Num, Caps and Scroll Locks.
207 .TP
208 \-\-nonewline
209 Do not print a newline before writing out /etc/issue.
210 .TP
211 \-\-nohostname
212 By default the hostname will be printed. With this option enabled,
213 no hostname at all will be shown.
214 .TP
215 \-\-long\-hostname
216 By default the hostname is only printed until the first dot. With
217 this option enabled, the full qualified hostname by gethostname()
218 or if not found by getaddrinfo() is shown.
219 .TP
220 \-\-version
221 Output version information and exit.
222 .TP
223 \-\-help
224 Output help screen and exit.
225 .PP
226 .SH EXAMPLES
227 This section shows examples for the process field of an entry in the
228 \fI/etc/inittab\fP file. You'll have to prepend appropriate values
229 for the other fields. See \fIinittab(5)\fP for more details.
230
231 For a hard-wired line or a console tty:
232 .ti +5
233 /sbin/agetty 9600 ttyS1
234
235 For a directly connected terminal without proper carriage detect wiring:
236 (try this if your terminal just sleeps instead of giving you a password:
237 prompt.)
238 .ti +5
239 /sbin/agetty \-L 9600 ttyS1 vt100
240
241 For a old style dial-in line with a 9600/2400/1200 baud modem:
242 .ti +5
243 /sbin/agetty \-mt60 ttyS1 9600,2400,1200
244
245 For a Hayes modem with a fixed 115200 bps interface to the machine:
246 (the example init string turns off modem echo and result codes, makes
247 modem/computer DCD track modem/modem DCD, makes a DTR drop cause a
248 dis-connection and turn on auto-answer after 1 ring.)
249 .ti +5
250 /sbin/agetty \-w \-I 'ATE0Q1&D2&C1S0=1\\015' 115200 ttyS1
251
252 .SH SECURITY NOTICE
253 If you use the \fB\-\-login\-program\fP and \fB\-\-login\-options\fP options,
254 be aware that a malicious user may try to enter lognames with embedded options,
255 which then get passed to the used login program. Agetty does check
256 for a leading "\-" and makes sure the logname gets passed as one parameter
257 (so embedded spaces will not create yet another parameter), but depending
258 on how the login binary parses the command line that might not be sufficient.
259 Check that the used login program can not be abused this way.
260 .PP
261 Some programs use "\-\-" to indicate that the rest of the commandline should
262 not be interpreted as options. Use this feature if available by passing "\-\-"
263 before the username gets passed by \\u.
264
265 .SH ISSUE ESCAPES
266 The issue-file (\fI/etc/issue\fP or the file set with the \-f option)
267 may contain certain escape codes to display the system name, date and
268 time etc. All escape codes consist of a backslash (\\) immediately
269 followed by one of the letters explained below.
270
271 .TP
272 4 or 4{interface}
273 Insert the IPv4 address of the machine hostname or IPv4 address the configured
274 network interface if the interface argument is specified (e.g. \\4{eth0}).
275 .TP
276 6 or 6{interface}
277 Insert the IPv6 address of the machine hostname or IPv6 address the configured
278 network interface if the interface argument is specified (e.g. \\6{eth0}}
279 .TP
280 b
281 Insert the baudrate of the current line.
282 .TP
283 d
284 Insert the current date.
285 .TP
286 s
287 Insert the system name, the name of the operating system. Same as `uname \-s'.
288 .TP
289 l
290 Insert the name of the current tty line.
291 .TP
292 m
293 Insert the architecture identifier of the machine. Same as `uname \-m'.
294 .TP
295 n
296 Insert the nodename of the machine, also known as the hostname. Same as `uname \-n'.
297 .TP
298 o
299 Insert the NIS domainname of the machine. Same as `hostname \-d'.
300 .TP
301 O
302 Insert the DNS domainname of the machine.
303 .TP
304 r
305 Insert the release number of the OS. Same as `uname \-r'.
306 .TP
307 t
308 Insert the current time.
309 .TP
310 u
311 Insert the number of current users logged in.
312 .TP
313 U
314 Insert the string "1 user" or "<n> users" where <n> is the number of current
315 users logged in.
316 .TP
317 v
318 Insert the version of the OS, eg. the build-date etc.
319 .TP
320 Example: On my system, the following \fI/etc/issue\fP file:
321
322 .na
323 .nf
324 .ti +.5
325 This is \\n.\\o (\\s \\m \\r) \\t
326 .TP
327 displays as
328
329 .ti +.5
330 This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30
331
332 .fi
333
334 .SH FILES
335 .na
336 .nf
337 /var/run/utmp, the system status file.
338 /etc/issue, printed before the login prompt.
339 /dev/console, problem reports (if syslog(3) is not used).
340 /etc/inittab, \fIinit\fP(8) configuration file.
341 .SH BUGS
342 .ad
343 .fi
344 The baud-rate detection feature (the \fI\-m\fP option) requires that
345 \fBagetty\fP be scheduled soon enough after completion of a dial-in
346 call (within 30 ms with modems that talk at 2400 baud). For robustness,
347 always use the \fI\-m\fP option in combination with a multiple baud
348 rate command-line argument, so that BREAK processing is enabled.
349
350 The text in the \fI/etc/issue\fP file (or other) and the login prompt
351 are always output with 7-bit characters and space parity.
352
353 The baud-rate detection feature (the \fI\-m\fP option) requires that
354 the modem emits its status message \fIafter\fP raising the DCD line.
355 .SH DIAGNOSTICS
356 .ad
357 .fi
358 Depending on how the program was configured, all diagnostics are
359 written to the console device or reported via the syslog(3) facility.
360 Error messages are produced if the \fIport\fP argument does not
361 specify a terminal device; if there is no utmp entry for the
362 current process (System V only); and so on.
363 .SH AUTHOR(S)
364 .na
365 .nf
366 W.Z. Venema <wietse@wzv.win.tue.nl>
367 Eindhoven University of Technology
368 Department of Mathematics and Computer Science
369 Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
370
371 Peter Orbaek <poe@daimi.aau.dk>
372 Linux port and more options. Still maintains the code.
373
374 Eric Rasmussen <ear@usfirst.org>
375 Added \-f option to display custom login messages on different terminals.
376
377 .SH AVAILABILITY
378 The agetty command is part of the util-linux package and is available from
379 ftp://ftp.kernel.org/pub/linux/utils/util\-linux/.