Correct BSD License clause numbering from 1-2-4 to 1-2-3.
[dragonfly.git] / libexec / telnetd / telnetd.8
1 .\" Copyright (c) 1983, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)telnetd.8   8.4 (Berkeley) 6/1/94
29 .\" $FreeBSD: src/crypto/telnet/telnetd/telnetd.8,v 1.5.2.6 2002/04/13 10:59:09 markm Exp $
30 .\" $DragonFly: src/crypto/telnet/telnetd/telnetd.8,v 1.2 2003/06/17 04:24:37 dillon Exp $
31 .\"
32 .Dd July 27, 2009
33 .Dt TELNETD 8
34 .Os
35 .Sh NAME
36 .Nm telnetd
37 .Nd DARPA
38 .Tn TELNET
39 protocol server
40 .Sh SYNOPSIS
41 .Nm /usr/libexec/telnetd
42 .\".Op Fl BUhlkn
43 .Op Fl Uhlkn
44 .Op Fl D Ar debugmode
45 .Op Fl S Ar tos
46 .Op Fl X Ar authtype
47 .Op Fl a Ar authmode
48 .Op Fl edebug
49 .Op Fl p Ar loginprog
50 .Op Fl u Ar len
51 .Op Fl debug Op Ar port
52 .Sh DESCRIPTION
53 The
54 .Nm
55 command is a server which supports the
56 .Tn DARPA
57 standard
58 .Tn TELNET
59 virtual terminal protocol.
60 .Nm Telnetd
61 is normally invoked by the internet server (see
62 .Xr inetd 8 )
63 for requests to connect to the
64 .Tn TELNET
65 port as indicated by the
66 .Pa /etc/services
67 file (see
68 .Xr services 5 ) .
69 The
70 .Fl debug
71 option may be used to start up
72 .Nm
73 manually, instead of through
74 .Xr inetd 8 .
75 If started up this way,
76 .Ar port
77 may be specified to run
78 .Nm
79 on an alternate
80 .Tn TCP
81 port number.
82 .Pp
83 The
84 .Nm
85 command accepts the following options:
86 .Bl -tag -width indent
87 .It Fl a Ar authmode
88 This option may be used for specifying what mode should
89 be used for authentication.
90 Note that this option is only useful if
91 .Nm
92 has been compiled with support for the
93 .Dv AUTHENTICATION
94 option.
95 There are several valid values for
96 .Ar authmode :
97 .Bl -tag -width debug
98 .It Cm debug
99 Turn on authentication debugging code.
100 .It Cm user
101 Only allow connections when the remote user
102 can provide valid authentication information
103 to identify the remote user,
104 and is allowed access to the specified account
105 without providing a password.
106 .It Cm valid
107 Only allow connections when the remote user
108 can provide valid authentication information
109 to identify the remote user.
110 The
111 .Xr login 1
112 command will provide any additional user verification
113 needed if the remote user is not allowed automatic
114 access to the specified account.
115 .It Cm other
116 Only allow connections that supply some authentication information.
117 This option is currently not supported
118 by any of the existing authentication mechanisms,
119 and is thus the same as specifying
120 .Fl a
121 .Cm valid .
122 .It Cm none
123 This is the default state.
124 Authentication information is not required.
125 If no or insufficient authentication information
126 is provided, then the
127 .Xr login 1
128 program will provide the necessary user
129 verification.
130 .It Cm off
131 Disable the authentication code.
132 All user verification will happen through the
133 .Xr login 1
134 program.
135 .El
136 .\".It Fl B
137 .\"Specify bftp server mode.
138 .\"In this mode,
139 .\".Nm
140 .\"causes login to start a
141 .\".Xr bftp 1
142 .\"session rather than the user's normal shell.
143 .\"In bftp daemon mode normal logins are not supported, and it must be used
144 .\"on a port other than the normal
145 .\".Tn TELNET
146 .\"port.
147 .It Fl D Ar debugmode
148 This option may be used for debugging purposes.
149 This allows
150 .Nm
151 to print out debugging information
152 to the connection, allowing the user to see what
153 .Nm
154 is doing.
155 There are several possible values for
156 .Ar debugmode :
157 .Bl -tag -width exercise
158 .It Cm options
159 Print information about the negotiation of
160 .Tn TELNET
161 options.
162 .It Cm report
163 Print the
164 .Cm options
165 information, plus some additional information
166 about what processing is going on.
167 .It Cm netdata
168 Display the data stream received by
169 .Nm .
170 .It Cm ptydata
171 Display data written to the pty.
172 .It Cm exercise
173 Has not been implemented yet.
174 .El
175 .It Fl debug
176 Enable debugging on each socket created by
177 .Nm
178 (see
179 .Dv SO_DEBUG
180 in
181 .Xr socket 2 ) .
182 .It Fl edebug
183 If
184 .Nm
185 has been compiled with support for data encryption, then the
186 .Fl edebug
187 option may be used to enable encryption debugging code.
188 .It Fl h
189 Disable the printing of host-specific information before
190 login has been completed.
191 .It Fl k
192 This option is only useful if
193 .Nm
194 has been compiled with both linemode and kludge linemode
195 support.
196 If the
197 .Fl k
198 option is specified, then if the remote client does not
199 support the
200 .Dv LINEMODE
201 option, then
202 .Nm
203 will operate in character at a time mode.
204 It will still support kludge linemode, but will only
205 go into kludge linemode if the remote client requests
206 it.
207 (This is done by the client sending
208 .Dv DONT SUPPRESS-GO-AHEAD
209 and
210 .Dv DONT ECHO . )
211 The
212 .Fl k
213 option is most useful when there are remote clients
214 that do not support kludge linemode, but pass the heuristic
215 (if they respond with
216 .Dv WILL TIMING-MARK
217 in response to a
218 .Dv DO TIMING-MARK )
219 for kludge linemode support.
220 .It Fl l
221 Specify line mode.
222 Try to force clients to use line-at-a-time mode.
223 If the
224 .Dv LINEMODE
225 option is not supported, it will go
226 into kludge linemode.
227 .It Fl n
228 Disable
229 .Dv TCP
230 keep-alives.
231 Normally
232 .Nm
233 enables the
234 .Tn TCP
235 keep-alive mechanism to probe connections that
236 have been idle for some period of time to determine
237 if the client is still there, so that idle connections
238 from machines that have crashed or can no longer
239 be reached may be cleaned up.
240 .It Fl p Ar loginprog
241 Specify an alternate
242 .Xr login 1
243 command to run to complete the login.
244 The alternate command must
245 understand the same command arguments as the standard login.
246 .It Fl S Ar tos
247 .It Fl u Ar len
248 This option is used to specify the size of the field
249 in the
250 .Dv utmp
251 structure that holds the remote host name.
252 If the resolved host name is longer than
253 .Ar len ,
254 the dotted decimal value will be used instead.
255 This allows hosts with very long host names that
256 overflow this field to still be uniquely identified.
257 Specifying
258 .Fl u0
259 indicates that only dotted decimal addresses
260 should be put into the
261 .Pa utmp
262 file.
263 .It Fl U
264 This option causes
265 .Nm
266 to refuse connections from addresses that
267 cannot be mapped back into a symbolic name
268 via the
269 .Xr gethostbyaddr 3
270 routine.
271 .It Fl X Ar authtype
272 This option is only valid if
273 .Nm
274 has been built with support for the authentication option.
275 It disables the use of
276 .Ar authtype
277 authentication, and
278 can be used to temporarily disable
279 a specific authentication type without having to recompile
280 .Nm .
281 .El
282 .Pp
283 .Nm Telnetd
284 operates by allocating a pseudo-terminal device (see
285 .Xr pty 4 )
286 for a client, then creating a login process which has
287 the slave side of the pseudo-terminal as
288 .Dv stdin ,
289 .Dv stdout
290 and
291 .Dv stderr .
292 .Nm Telnetd
293 manipulates the master side of the pseudo-terminal,
294 implementing the
295 .Tn TELNET
296 protocol and passing characters
297 between the remote client and the login process.
298 .Pp
299 When a
300 .Tn TELNET
301 session is started up,
302 .Nm
303 sends
304 .Tn TELNET
305 options to the client side indicating
306 a willingness to do the
307 following
308 .Tn TELNET
309 options, which are described in more detail below:
310 .Bd -literal -offset indent
311 DO AUTHENTICATION
312 WILL ENCRYPT
313 DO TERMINAL TYPE
314 DO TSPEED
315 DO XDISPLOC
316 DO NEW-ENVIRON
317 DO ENVIRON
318 WILL SUPPRESS GO AHEAD
319 DO ECHO
320 DO LINEMODE
321 DO NAWS
322 WILL STATUS
323 DO LFLOW
324 DO TIMING-MARK
325 .Ed
326 .Pp
327 The pseudo-terminal allocated to the client is configured
328 to operate in
329 .Dq cooked
330 mode, and with
331 .Dv XTABS and
332 .Dv CRMOD
333 enabled (see
334 .Xr tty 4 ) .
335 .Pp
336 .Nm Telnetd
337 has support for enabling locally the following
338 .Tn TELNET
339 options:
340 .Bl -tag -width "DO AUTHENTICATION"
341 .It "WILL ECHO"
342 When the
343 .Dv LINEMODE
344 option is enabled, a
345 .Dv WILL ECHO
346 or
347 .Dv WONT ECHO
348 will be sent to the client to indicate the
349 current state of terminal echoing.
350 When terminal echo is not desired, a
351 .Dv WILL ECHO
352 is sent to indicate that
353 .Nm
354 will take care of echoing any data that needs to be
355 echoed to the terminal, and then nothing is echoed.
356 When terminal echo is desired, a
357 .Dv WONT ECHO
358 is sent to indicate that
359 .Nm
360 will not be doing any terminal echoing, so the
361 client should do any terminal echoing that is needed.
362 .It "WILL BINARY"
363 Indicate that the client is willing to send a
364 8 bits of data, rather than the normal 7 bits
365 of the Network Virtual Terminal.
366 .It "WILL SGA"
367 Indicate that it will not be sending
368 .Dv IAC GA ,
369 go ahead, commands.
370 .It "WILL STATUS"
371 Indicate a willingness to send the client, upon
372 request, of the current status of all
373 .Tn TELNET
374 options.
375 .It "WILL TIMING-MARK"
376 Whenever a
377 .Dv DO TIMING-MARK
378 command is received, it is always responded
379 to with a
380 .Dv WILL TIMING-MARK .
381 .It "WILL LOGOUT"
382 When a
383 .Dv DO LOGOUT
384 is received, a
385 .Dv WILL LOGOUT
386 is sent in response, and the
387 .Tn TELNET
388 session is shut down.
389 .It "WILL ENCRYPT"
390 Only sent if
391 .Nm
392 is compiled with support for data encryption, and
393 indicates a willingness to decrypt
394 the data stream.
395 .El
396 .Pp
397 .Nm Telnetd
398 has support for enabling remotely the following
399 .Tn TELNET
400 options:
401 .Bl -tag -width "DO AUTHENTICATION"
402 .It "DO BINARY"
403 Sent to indicate that
404 .Nm
405 is willing to receive an 8 bit data stream.
406 .It "DO LFLOW"
407 Requests that the client handle flow control
408 characters remotely.
409 .It "DO ECHO"
410 This is not really supported, but is sent to identify a
411 .Bx 4.2
412 .Xr telnet 1
413 client, which will improperly respond with
414 .Dv WILL ECHO .
415 If a
416 .Dv WILL ECHO
417 is received, a
418 .Dv DONT ECHO
419 will be sent in response.
420 .It "DO TERMINAL-TYPE"
421 Indicate a desire to be able to request the
422 name of the type of terminal that is attached
423 to the client side of the connection.
424 .It "DO SGA"
425 Indicate that it does not need to receive
426 .Dv IAC GA ,
427 the go ahead command.
428 .It "DO NAWS"
429 Requests that the client inform the server when
430 the window (display) size changes.
431 .It "DO TERMINAL-SPEED"
432 Indicate a desire to be able to request information
433 about the speed of the serial line to which
434 the client is attached.
435 .It "DO XDISPLOC"
436 Indicate a desire to be able to request the name
437 of the X Window System display that is associated with
438 the telnet client.
439 .It "DO NEW-ENVIRON"
440 Indicate a desire to be able to request environment
441 variable information, as described in RFC 1572.
442 .It "DO ENVIRON"
443 Indicate a desire to be able to request environment
444 variable information, as described in RFC 1408.
445 .It "DO LINEMODE"
446 Only sent if
447 .Nm
448 is compiled with support for linemode, and
449 requests that the client do line by line processing.
450 .It "DO TIMING-MARK"
451 Only sent if
452 .Nm
453 is compiled with support for both linemode and
454 kludge linemode, and the client responded with
455 .Dv WONT LINEMODE .
456 If the client responds with
457 .Dv WILL TM ,
458 the it is assumed that the client supports
459 kludge linemode.
460 Note that the
461 .Op Fl k
462 option can be used to disable this.
463 .It "DO AUTHENTICATION"
464 Only sent if
465 .Nm
466 is compiled with support for authentication, and
467 indicates a willingness to receive authentication
468 information for automatic login.
469 .It "DO ENCRYPT"
470 Only sent if
471 .Nm
472 is compiled with support for data encryption, and
473 indicates a willingness to decrypt
474 the data stream.
475 .El
476 .Sh NOTES
477 By default
478 .Nm
479 will read the
480 .Em \&he ,
481 .Em \&hn ,
482 and
483 .Em \&im
484 capabilities from
485 .Pa /etc/gettytab
486 and use that information (if present) to determine
487 what to display before the login: prompt.
488 You can also use a System V style
489 .Pa /etc/issue
490 file by using the
491 .Em \&if
492 capability, which will override
493 .Em \&im .
494 The information specified in either
495 .Em \&im
496 or
497 .Em \&if
498 will be displayed to both console and remote logins.
499 .\" .Sh ENVIRONMENT
500 .Sh FILES
501 .Bl -tag -width ".Pa /etc/services" -compact
502 .It Pa /etc/services
503 .It Pa /etc/gettytab
504 .It Pa /etc/iptos
505 (if supported)
506 .\".It Pa /usr/ucb/bftp
507 .\"(if supported)
508 .El
509 .Sh "SEE ALSO"
510 .\".Xr bftp 1 ,
511 .Xr login 1 ,
512 .Xr telnet 1
513 (if supported),
514 .Xr gettytab 5
515 .Sh STANDARDS
516 .Bl -tag -compact -width ".Cm RFC 1572"
517 .It Cm RFC 854
518 .Tn TELNET
519 PROTOCOL SPECIFICATION
520 .It Cm RFC 855
521 TELNET OPTION SPECIFICATIONS
522 .It Cm RFC 856
523 TELNET BINARY TRANSMISSION
524 .It Cm RFC 857
525 TELNET ECHO OPTION
526 .It Cm RFC 858
527 TELNET SUPPRESS GO AHEAD OPTION
528 .It Cm RFC 859
529 TELNET STATUS OPTION
530 .It Cm RFC 860
531 TELNET TIMING MARK OPTION
532 .It Cm RFC 861
533 TELNET EXTENDED OPTIONS - LIST OPTION
534 .It Cm RFC 885
535 TELNET END OF RECORD OPTION
536 .It Cm RFC 1073
537 Telnet Window Size Option
538 .It Cm RFC 1079
539 Telnet Terminal Speed Option
540 .It Cm RFC 1091
541 Telnet Terminal-Type Option
542 .It Cm RFC 1096
543 Telnet X Display Location Option
544 .It Cm RFC 1123
545 Requirements for Internet Hosts -- Application and Support
546 .It Cm RFC 1184
547 Telnet Linemode Option
548 .It Cm RFC 1372
549 Telnet Remote Flow Control Option
550 .It Cm RFC 1416
551 Telnet Authentication Option
552 .It Cm RFC 1411
553 Telnet Authentication: Kerberos Version 4
554 .It Cm RFC 1412
555 Telnet Authentication: SPX
556 .It Cm RFC 1571
557 Telnet Environment Option Interoperability Issues
558 .It Cm RFC 1572
559 Telnet Environment Option
560 .El
561 .Sh HISTORY
562 IPv6 support was added by WIDE/KAME project.
563 .Sh BUGS
564 Some
565 .Tn TELNET
566 commands are only partially implemented.
567 .Pp
568 Because of bugs in the original
569 .Bx 4.2
570 .Xr telnet 1 ,
571 .Nm
572 performs some dubious protocol exchanges to try to discover if the remote
573 client is, in fact, a
574 .Bx 4.2
575 .Xr telnet 1 .
576 .Pp
577 Binary mode
578 has no common interpretation except between similar operating systems
579 (Unix in this case).
580 .Pp
581 The terminal type name received from the remote client is converted to
582 lower case.
583 .Pp
584 .Nm Telnetd
585 never sends
586 .Tn TELNET
587 .Dv IAC GA
588 (go ahead) commands.