Merge from vendor branch NTPD:
[dragonfly.git] / crypto / telnet / telnet / telnet.1
1 .\" Copyright (c) 1983, 1990, 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. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)telnet.1    8.6 (Berkeley) 6/1/94
33 .\" $FreeBSD: src/crypto/telnet/telnet/telnet.1,v 1.4.2.9 2002/04/13 10:59:08 markm Exp $
34 .\" $DragonFly: src/crypto/telnet/telnet/telnet.1,v 1.2 2003/06/17 04:24:37 dillon Exp $
35 .\"
36 .Dd January 27, 2000
37 .Dt TELNET 1
38 .Os
39 .Sh NAME
40 .Nm telnet
41 .Nd user interface to the
42 .Tn TELNET
43 protocol
44 .Sh SYNOPSIS
45 .Nm
46 .Op Fl 468EFKLNacdfruxy
47 .Op Fl S Ar tos
48 .Op Fl X Ar authtype
49 .Op Fl e Ar escapechar
50 .Op Fl k Ar realm
51 .Op Fl l Ar user
52 .Op Fl n Ar tracefile
53 .Op Fl s Ar src_addr
54 .Oo
55 .Ar host
56 .Op Ar port
57 .Oc
58 .Sh DESCRIPTION
59 The
60 .Nm
61 command
62 is used to communicate with another host using the
63 .Tn TELNET
64 protocol.
65 If
66 .Nm
67 is invoked without the
68 .Ar host
69 argument, it enters command mode,
70 indicated by its prompt
71 .Pq Dq Li telnet\&> .
72 In this mode, it accepts and executes the commands listed below.
73 If it is invoked with arguments, it performs an
74 .Ic open
75 command with those arguments.
76 .Pp
77 Options:
78 .Bl -tag -width indent
79 .It Fl 4
80 Forces
81 .Nm
82 to use IPv4 addresses only.
83 .It Fl 6
84 Forces
85 .Nm
86 to use IPv6 addresses only.
87 .It Fl 8
88 Specifies an 8-bit data path.  This causes an attempt to
89 negotiate the
90 .Dv TELNET BINARY
91 option on both input and output.
92 .It Fl E
93 Stops any character from being recognized as an escape character.
94 .It Fl F
95 If Kerberos V5 authentication is being used, the
96 .Fl F
97 option allows the local credentials to be forwarded
98 to the remote system, including any credentials that
99 have already been forwarded into the local environment.
100 .It Fl K
101 Specifies no automatic login to the remote system.
102 .It Fl L
103 Specifies an 8-bit data path on output.  This causes the
104 .Dv BINARY
105 option to be negotiated on output.
106 .It Fl N
107 Prevents IP address to name lookup when destination host is given
108 as an IP address.
109 .It Fl S Ar tos
110 Sets the IP type-of-service (TOS) option for the telnet
111 connection to the value
112 .Ar tos ,
113 which can be a numeric TOS value
114 or, on systems that support it, a symbolic
115 TOS name found in the
116 .Pa /etc/iptos
117 file.
118 .It Fl X Ar atype
119 Disables the
120 .Ar atype
121 type of authentication.
122 .It Fl a
123 Attempt automatic login.
124 This is now the default, so this option is ignored.
125 Currently, this sends the user name via the
126 .Ev USER
127 variable
128 of the
129 .Ev ENVIRON
130 option if supported by the remote system.
131 The name used is that of the current user as returned by
132 .Xr getlogin 2
133 if it agrees with the current user ID,
134 otherwise it is the name associated with the user ID.
135 .It Fl c
136 Disables the reading of the user's
137 .Pa \&.telnetrc
138 file.  (See the
139 .Ic toggle skiprc
140 command on this man page.)
141 .It Fl d
142 Sets the initial value of the
143 .Ic debug
144 toggle to
145 .Dv TRUE .
146 .It Fl e Ar escapechar
147 Sets the initial
148 .Nm
149 escape character to
150 .Ar escapechar .
151 If
152 .Ar escapechar
153 is omitted, then
154 there will be no escape character.
155 .It Fl f
156 If Kerberos V5 authentication is being used, the
157 .Fl f
158 option allows the local credentials to be forwarded to the remote system.
159 .It Fl k Ar realm
160 If Kerberos authentication is being used, the
161 .Fl k
162 option requests that
163 .Nm
164 obtain tickets for the remote host in
165 realm
166 .Ar realm
167 instead of the remote host's realm, as determined by
168 .Xr krb_realmofhost 3 .
169 .It Fl l Ar user
170 When connecting to the remote system, if the remote system
171 understands the
172 .Ev ENVIRON
173 option, then
174 .Ar user
175 will be sent to the remote system as the value for the variable
176 .Ev USER .
177 This option implies the
178 .Fl a
179 option.
180 This option may also be used with the
181 .Ic open
182 command.
183 .It Fl n Ar tracefile
184 Opens
185 .Ar tracefile
186 for recording trace information.
187 See the
188 .Ic set tracefile
189 command below.
190 .It Fl r
191 Specifies a user interface similar to
192 .Xr rlogin 1 .
193 In this
194 mode, the escape character is set to the tilde (~) character,
195 unless modified by the
196 .Fl e
197 option.
198 .It Fl s Ar src_addr
199 Set the source IP address for the
200 .Nm
201 connection to
202 .Ar src_addr ,
203 which can be an IP address or a host name.
204 .It Fl u
205 Forces
206 .Nm
207 to use
208 .Dv AF_UNIX
209 addresses only (e.g.,
210 .Ux
211 domain sockets, accessed with a file path).
212 .It Fl x
213 Turns on encryption of the data stream if possible.
214 This is now the default, so this option is ignored.
215 .It Fl y
216 Suppresses encryption of the data stream.
217 .It Ar host
218 Indicates the official name, an alias, or the Internet address
219 of a remote host.
220 If
221 .Ar host
222 starts with a
223 .Ql / ,
224 .Nm
225 establishes a connection to the corresponding named socket.
226 .It Ar port
227 Indicates a port number (address of an application).  If a number is
228 not specified, the default
229 .Nm
230 port is used.
231 .El
232 .Pp
233 When in rlogin mode, a line of the form ~.  disconnects from the
234 remote host; ~ is the
235 .Nm
236 escape character.
237 Similarly, the line ~^Z suspends the
238 .Nm
239 session.
240 The line ~^] escapes to the normal
241 .Nm
242 escape prompt.
243 .Pp
244 Once a connection has been opened,
245 .Nm
246 will attempt to enable the
247 .Dv TELNET LINEMODE
248 option.
249 If this fails, then
250 .Nm
251 will revert to one of two input modes:
252 either \*(Lqcharacter at a time\*(Rq
253 or \*(Lqold line by line\*(Rq
254 depending on what the remote system supports.
255 .Pp
256 When
257 .Dv LINEMODE
258 is enabled, character processing is done on the
259 local system, under the control of the remote system.  When input
260 editing or character echoing is to be disabled, the remote system
261 will relay that information.  The remote system will also relay
262 changes to any special characters that happen on the remote
263 system, so that they can take effect on the local system.
264 .Pp
265 In \*(Lqcharacter at a time\*(Rq mode, most
266 text typed is immediately sent to the remote host for processing.
267 .Pp
268 In \*(Lqold line by line\*(Rq mode, all text is echoed locally,
269 and (normally) only completed lines are sent to the remote host.
270 The \*(Lqlocal echo character\*(Rq (initially \*(Lq^E\*(Rq) may be used
271 to turn off and on the local echo
272 (this would mostly be used to enter passwords
273 without the password being echoed).
274 .Pp
275 If the
276 .Dv LINEMODE
277 option is enabled, or if the
278 .Ic localchars
279 toggle is
280 .Dv TRUE
281 (the default for \*(Lqold line by line\*(Rq; see below),
282 the user's
283 .Ic quit  ,
284 .Ic intr ,
285 and
286 .Ic flush
287 characters are trapped locally, and sent as
288 .Tn TELNET
289 protocol sequences to the remote side.
290 If
291 .Dv LINEMODE
292 has ever been enabled, then the user's
293 .Ic susp
294 and
295 .Ic eof
296 are also sent as
297 .Tn TELNET
298 protocol sequences,
299 and
300 .Ic quit
301 is sent as a
302 .Dv TELNET ABORT
303 instead of
304 .Dv BREAK .
305 There are options (see
306 .Ic toggle
307 .Ic autoflush
308 and
309 .Ic toggle
310 .Ic autosynch
311 below)
312 which cause this action to flush subsequent output to the terminal
313 (until the remote host acknowledges the
314 .Tn TELNET
315 sequence) and flush previous terminal input
316 (in the case of
317 .Ic quit
318 and
319 .Ic intr  ) .
320 .Pp
321 While connected to a remote host,
322 .Nm
323 command mode may be entered by typing the
324 .Nm
325 \*(Lqescape character\*(Rq (initially \*(Lq^]\*(Rq).
326 When in command mode, the normal terminal editing conventions are available.
327 .Pp
328 The following
329 .Nm
330 commands are available.
331 Only enough of each command to uniquely identify it need be typed
332 (this is also true for arguments to the
333 .Ic mode  ,
334 .Ic set ,
335 .Ic toggle  ,
336 .Ic unset ,
337 .Ic slc  ,
338 .Ic environ ,
339 and
340 .Ic display
341 commands).
342 .Pp
343 .Bl -tag -width "mode type"
344 .It Ic auth Ar argument ...
345 The auth command manipulates the information sent through the
346 .Dv TELNET AUTHENTICATE
347 option.  Valid arguments for the
348 .Ic auth
349 command are:
350 .Bl -tag -width "disable type"
351 .It Ic disable Ar type
352 Disables the specified type of authentication.  To
353 obtain a list of available types, use the
354 .Ic auth disable ?\&
355 command.
356 .It Ic enable Ar type
357 Enables the specified type of authentication.  To
358 obtain a list of available types, use the
359 .Ic auth enable ?\&
360 command.
361 .It Ic status
362 Lists the current status of the various types of
363 authentication.
364 .El
365 .It Ic close
366 Close a
367 .Tn TELNET
368 session and return to command mode.
369 .It Ic display Ar argument ...
370 Displays all, or some, of the
371 .Ic set
372 and
373 .Ic toggle
374 values (see below).
375 .It Ic encrypt Ar argument ...
376 The encrypt command manipulates the information sent through the
377 .Dv TELNET ENCRYPT
378 option.
379 .Pp
380 Valid arguments for the
381 .Ic encrypt
382 command are:
383 .Bl -tag -width Ar
384 .It Ic disable Ar type Xo
385 .Op Cm input | output
386 .Xc
387 Disables the specified type of encryption.  If you
388 omit the input and output, both input and output
389 are disabled.  To obtain a list of available
390 types, use the
391 .Ic encrypt disable ?\&
392 command.
393 .It Ic enable Ar type Xo
394 .Op Cm input | output
395 .Xc
396 Enables the specified type of encryption.  If you
397 omit input and output, both input and output are
398 enabled.  To obtain a list of available types, use the
399 .Ic encrypt enable ?\&
400 command.
401 .It Ic input
402 This is the same as the
403 .Ic encrypt start input
404 command.
405 .It Ic -input
406 This is the same as the
407 .Ic encrypt stop input
408 command.
409 .It Ic output
410 This is the same as the
411 .Ic encrypt start output
412 command.
413 .It Ic -output
414 This is the same as the
415 .Ic encrypt stop output
416 command.
417 .It Ic start Op Cm input | output
418 Attempts to start encryption.  If you omit
419 .Ic input
420 and
421 .Ic output ,
422 both input and output are enabled.  To
423 obtain a list of available types, use the
424 .Ic encrypt enable ?\&
425 command.
426 .It Ic status
427 Lists the current status of encryption.
428 .It Ic stop Op Cm input | output
429 Stops encryption.  If you omit input and output,
430 encryption is on both input and output.
431 .It Ic type Ar type
432 Sets the default type of encryption to be used
433 with later
434 .Ic encrypt start
435 or
436 .Ic encrypt stop
437 commands.
438 .El
439 .It Ic environ Ar arguments ...
440 The
441 .Ic environ
442 command is used to manipulate the
443 variables that may be sent through the
444 .Dv TELNET ENVIRON
445 option.
446 The initial set of variables is taken from the users
447 environment, with only the
448 .Ev DISPLAY
449 and
450 .Ev PRINTER
451 variables being exported by default.
452 The
453 .Ev USER
454 variable is also exported if the
455 .Fl a
456 or
457 .Fl l
458 options are used.
459 .Pp
460 Valid arguments for the
461 .Ic environ
462 command are:
463 .Bl -tag -width Fl
464 .It Ic define Ar variable value
465 Define the variable
466 .Ar variable
467 to have a value of
468 .Ar value .
469 Any variables defined by this command are automatically exported.
470 The
471 .Ar value
472 may be enclosed in single or double quotes so
473 that tabs and spaces may be included.
474 .It Ic undefine Ar variable
475 Remove
476 .Ar variable
477 from the list of environment variables.
478 .It Ic export Ar variable
479 Mark the variable
480 .Ar variable
481 to be exported to the remote side.
482 .It Ic unexport Ar variable
483 Mark the variable
484 .Ar variable
485 to not be exported unless
486 explicitly asked for by the remote side.
487 .It Ic list
488 List the current set of environment variables.
489 Those marked with a
490 .Cm *
491 will be sent automatically,
492 other variables will only be sent if explicitly requested.
493 .It Ic ?\&
494 Prints out help information for the
495 .Ic environ
496 command.
497 .El
498 .It Ic logout
499 Sends the
500 .Dv TELNET LOGOUT
501 option to the remote side.
502 This command is similar to a
503 .Ic close
504 command; however, if the remote side does not support the
505 .Dv LOGOUT
506 option, nothing happens.
507 If, however, the remote side does support the
508 .Dv LOGOUT
509 option, this command should cause the remote side to close the
510 .Tn TELNET
511 connection.
512 If the remote side also supports the concept of
513 suspending a user's session for later reattachment,
514 the logout argument indicates that you
515 should terminate the session immediately.
516 .It Ic mode Ar type
517 .Ar Type
518 is one of several options, depending on the state of the
519 .Tn TELNET
520 session.
521 The remote host is asked for permission to go into the requested mode.
522 If the remote host is capable of entering that mode, the requested
523 mode will be entered.
524 .Bl -tag -width Ar
525 .It Ic character
526 Disable the
527 .Dv TELNET LINEMODE
528 option, or, if the remote side does not understand the
529 .Dv LINEMODE
530 option, then enter \*(Lqcharacter at a time\*(Rq mode.
531 .It Ic line
532 Enable the
533 .Dv TELNET LINEMODE
534 option, or, if the remote side does not understand the
535 .Dv LINEMODE
536 option, then attempt to enter \*(Lqold-line-by-line\*(Rq mode.
537 .It Ic isig Pq Ic \-isig
538 Attempt to enable (disable) the
539 .Dv TRAPSIG
540 mode of the
541 .Dv LINEMODE
542 option.
543 This requires that the
544 .Dv LINEMODE
545 option be enabled.
546 .It Ic edit Pq Ic \-edit
547 Attempt to enable (disable) the
548 .Dv EDIT
549 mode of the
550 .Dv LINEMODE
551 option.
552 This requires that the
553 .Dv LINEMODE
554 option be enabled.
555 .It Ic softtabs Pq Ic \-softtabs
556 Attempt to enable (disable) the
557 .Dv SOFT_TAB
558 mode of the
559 .Dv LINEMODE
560 option.
561 This requires that the
562 .Dv LINEMODE
563 option be enabled.
564 .It Ic litecho Pq Ic \-litecho
565 Attempt to enable (disable) the
566 .Dv LIT_ECHO
567 mode of the
568 .Dv LINEMODE
569 option.
570 This requires that the
571 .Dv LINEMODE
572 option be enabled.
573 .It Ic ?\&
574 Prints out help information for the
575 .Ic mode
576 command.
577 .El
578 .It Xo
579 .Ic open Ar host
580 .Op Fl l Ar user
581 .Op Oo Fl Oc Ns Ar port
582 .Xc
583 Open a connection to the named host.
584 If no port number
585 is specified,
586 .Nm
587 will attempt to contact a
588 .Tn TELNET
589 server at the default port.
590 The host specification may be either a host name (see
591 .Xr hosts  5  ) ,
592 an Internet address specified in the \*(Lqdot notation\*(Rq (see
593 .Xr inet 3 ) ,
594 or IPv6 host name or IPv6 coloned-hexadecimal addreess.
595 The
596 .Fl l
597 option may be used to specify the user name
598 to be passed to the remote system via the
599 .Ev ENVIRON
600 option.
601 When connecting to a non-standard port,
602 .Nm
603 omits any automatic initiation of
604 .Tn TELNET
605 options.  When the port number is preceded by a minus sign,
606 the initial option negotiation is done.
607 After establishing a connection, the file
608 .Pa \&.telnetrc
609 in the
610 users home directory is opened.  Lines beginning with a # are
611 comment lines.  Blank lines are ignored.  Lines that begin
612 without white space are the start of a machine entry.  The
613 first thing on the line is the name of the machine that is
614 being connected to.  The rest of the line, and successive
615 lines that begin with white space are assumed to be
616 .Nm
617 commands and are processed as if they had been typed
618 in manually to the
619 .Nm
620 command prompt.
621 .It Ic quit
622 Close any open
623 .Tn TELNET
624 session and exit
625 .Nm .
626 An end of file (in command mode) will also close a session and exit.
627 .It Ic send Ar arguments
628 Sends one or more special character sequences to the remote host.
629 The following are the arguments which may be specified
630 (more than one argument may be specified at a time):
631 .Pp
632 .Bl -tag -width escape
633 .It Ic abort
634 Sends the
635 .Dv TELNET ABORT
636 (Abort
637 processes)
638 sequence.
639 .It Ic ao
640 Sends the
641 .Dv TELNET AO
642 (Abort Output) sequence, which should cause the remote system to flush
643 all output
644 .Em from
645 the remote system
646 .Em to
647 the user's terminal.
648 .It Ic ayt
649 Sends the
650 .Dv TELNET AYT
651 (Are You There)
652 sequence, to which the remote system may or may not choose to respond.
653 .It Ic brk
654 Sends the
655 .Dv TELNET BRK
656 (Break) sequence, which may have significance to the remote
657 system.
658 .It Ic ec
659 Sends the
660 .Dv TELNET EC
661 (Erase Character)
662 sequence, which should cause the remote system to erase the last character
663 entered.
664 .It Ic el
665 Sends the
666 .Dv TELNET EL
667 (Erase Line)
668 sequence, which should cause the remote system to erase the line currently
669 being entered.
670 .It Ic eof
671 Sends the
672 .Dv TELNET EOF
673 (End Of File)
674 sequence.
675 .It Ic eor
676 Sends the
677 .Dv TELNET EOR
678 (End of Record)
679 sequence.
680 .It Ic escape
681 Sends the current
682 .Nm
683 escape character (initially \*(Lq^\*(Rq).
684 .It Ic ga
685 Sends the
686 .Dv TELNET GA
687 (Go Ahead)
688 sequence, which likely has no significance to the remote system.
689 .It Ic getstatus
690 If the remote side supports the
691 .Dv TELNET STATUS
692 command,
693 .Ic getstatus
694 will send the subnegotiation to request that the server send
695 its current option status.
696 .It Ic ip
697 Sends the
698 .Dv TELNET IP
699 (Interrupt Process) sequence, which should cause the remote
700 system to abort the currently running process.
701 .It Ic nop
702 Sends the
703 .Dv TELNET NOP
704 (No OPeration)
705 sequence.
706 .It Ic susp
707 Sends the
708 .Dv TELNET SUSP
709 (SUSPend process)
710 sequence.
711 .It Ic synch
712 Sends the
713 .Dv TELNET SYNCH
714 sequence.
715 This sequence causes the remote system to discard all previously typed
716 (but not yet read) input.
717 This sequence is sent as
718 .Tn TCP
719 urgent
720 data (and may not work if the remote system is a
721 .Bx 4.2
722 system -- if
723 it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal).
724 .It Ic do Ar cmd
725 .It Ic dont Ar cmd
726 .It Ic will Ar cmd
727 .It Ic wont Ar cmd
728 Sends the
729 .Dv TELNET DO
730 .Ar cmd
731 sequence.
732 .Ar Cmd
733 can be either a decimal number between 0 and 255,
734 or a symbolic name for a specific
735 .Dv TELNET
736 command.
737 .Ar Cmd
738 can also be either
739 .Ic help
740 or
741 .Ic ?\&
742 to print out help information, including
743 a list of known symbolic names.
744 .It Ic ?\&
745 Prints out help information for the
746 .Ic send
747 command.
748 .El
749 .It Ic set Ar argument value
750 .It Ic unset Ar argument value
751 The
752 .Ic set
753 command will set any one of a number of
754 .Nm
755 variables to a specific value or to
756 .Dv TRUE .
757 The special value
758 .Ic off
759 turns off the function associated with
760 the variable, this is equivalent to using the
761 .Ic unset
762 command.
763 The
764 .Ic unset
765 command will disable or set to
766 .Dv FALSE
767 any of the specified functions.
768 The values of variables may be interrogated with the
769 .Ic display
770 command.
771 The variables which may be set or unset, but not toggled, are
772 listed here.  In addition, any of the variables for the
773 .Ic toggle
774 command may be explicitly set or unset using
775 the
776 .Ic set
777 and
778 .Ic unset
779 commands.
780 .Bl -tag -width escape
781 .It Ic ayt
782 If
783 .Tn TELNET
784 is in localchars mode, or
785 .Dv LINEMODE
786 is enabled, and the status character is typed, a
787 .Dv TELNET AYT
788 sequence (see
789 .Ic send ayt
790 preceding) is sent to the
791 remote host.  The initial value for the \*(LqAre You There\*(Rq
792 character is the terminal's status character.
793 .It Ic echo
794 This is the value (initially \*(Lq^E\*(Rq) which, when in
795 \*(Lqline by line\*(Rq mode, toggles between doing local echoing
796 of entered characters (for normal processing), and suppressing
797 echoing of entered characters (for entering, say, a password).
798 .It Ic eof
799 If
800 .Nm
801 is operating in
802 .Dv LINEMODE
803 or \*(Lqold line by line\*(Rq mode, entering this character
804 as the first character on a line will cause this character to be
805 sent to the remote system.
806 The initial value of the eof character is taken to be the terminal's
807 .Ic eof
808 character.
809 .It Ic erase
810 If
811 .Nm
812 is in
813 .Ic localchars
814 mode (see
815 .Ic toggle
816 .Ic localchars
817 below),
818 .Sy and
819 if
820 .Nm
821 is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
822 character is typed, a
823 .Dv TELNET EC
824 sequence (see
825 .Ic send
826 .Ic ec
827 above)
828 is sent to the remote system.
829 The initial value for the erase character is taken to be
830 the terminal's
831 .Ic erase
832 character.
833 .It Ic escape
834 This is the
835 .Nm
836 escape character (initially \*(Lq^[\*(Rq) which causes entry
837 into
838 .Nm
839 command mode (when connected to a remote system).
840 .It Ic flushoutput
841 If
842 .Nm
843 is in
844 .Ic localchars
845 mode (see
846 .Ic toggle
847 .Ic localchars
848 below)
849 and the
850 .Ic flushoutput
851 character is typed, a
852 .Dv TELNET AO
853 sequence (see
854 .Ic send
855 .Ic ao
856 above)
857 is sent to the remote host.
858 The initial value for the flush character is taken to be
859 the terminal's
860 .Ic flush
861 character.
862 .It Ic forw1
863 .It Ic forw2
864 If
865 .Nm
866 is operating in
867 .Dv LINEMODE ,
868 these are the
869 characters that, when typed, cause partial lines to be
870 forwarded to the remote system.  The initial value for
871 the forwarding characters are taken from the terminal's
872 eol and eol2 characters.
873 .It Ic interrupt
874 If
875 .Nm
876 is in
877 .Ic localchars
878 mode (see
879 .Ic toggle
880 .Ic localchars
881 below)
882 and the
883 .Ic interrupt
884 character is typed, a
885 .Dv TELNET IP
886 sequence (see
887 .Ic send
888 .Ic ip
889 above)
890 is sent to the remote host.
891 The initial value for the interrupt character is taken to be
892 the terminal's
893 .Ic intr
894 character.
895 .It Ic kill
896 If
897 .Nm
898 is in
899 .Ic localchars
900 mode (see
901 .Ic toggle
902 .Ic localchars
903 below),
904 .Ic and
905 if
906 .Nm
907 is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
908 character is typed, a
909 .Dv TELNET EL
910 sequence (see
911 .Ic send
912 .Ic el
913 above)
914 is sent to the remote system.
915 The initial value for the kill character is taken to be
916 the terminal's
917 .Ic kill
918 character.
919 .It Ic lnext
920 If
921 .Nm
922 is operating in
923 .Dv LINEMODE
924 or \*(Lqold line by line\*(Rq mode, then this character is taken to
925 be the terminal's
926 .Ic lnext
927 character.
928 The initial value for the lnext character is taken to be
929 the terminal's
930 .Ic lnext
931 character.
932 .It Ic quit
933 If
934 .Nm
935 is in
936 .Ic localchars
937 mode (see
938 .Ic toggle
939 .Ic localchars
940 below)
941 and the
942 .Ic quit
943 character is typed, a
944 .Dv TELNET BRK
945 sequence (see
946 .Ic send
947 .Ic brk
948 above)
949 is sent to the remote host.
950 The initial value for the quit character is taken to be
951 the terminal's
952 .Ic quit
953 character.
954 .It Ic reprint
955 If
956 .Nm
957 is operating in
958 .Dv LINEMODE
959 or \*(Lqold line by line\*(Rq mode, then this character is taken to
960 be the terminal's
961 .Ic reprint
962 character.
963 The initial value for the reprint character is taken to be
964 the terminal's
965 .Ic reprint
966 character.
967 .It Ic rlogin
968 This is the rlogin escape character.
969 If set, the normal
970 .Nm
971 escape character is ignored unless it is
972 preceded by this character at the beginning of a line.
973 This character, at the beginning of a line followed by
974 a "."  closes the connection; when followed by a ^Z it
975 suspends the
976 .Nm
977 command.  The initial state is to
978 disable the
979 .Nm rlogin
980 escape character.
981 .It Ic start
982 If the
983 .Dv TELNET TOGGLE-FLOW-CONTROL
984 option has been enabled,
985 then this character is taken to
986 be the terminal's
987 .Ic start
988 character.
989 The initial value for the start character is taken to be
990 the terminal's
991 .Ic start
992 character.
993 .It Ic stop
994 If the
995 .Dv TELNET TOGGLE-FLOW-CONTROL
996 option has been enabled,
997 then this character is taken to
998 be the terminal's
999 .Ic stop
1000 character.
1001 The initial value for the stop character is taken to be
1002 the terminal's
1003 .Ic stop
1004 character.
1005 .It Ic susp
1006 If
1007 .Nm
1008 is in
1009 .Ic localchars
1010 mode, or
1011 .Dv LINEMODE
1012 is enabled, and the
1013 .Ic suspend
1014 character is typed, a
1015 .Dv TELNET SUSP
1016 sequence (see
1017 .Ic send
1018 .Ic susp
1019 above)
1020 is sent to the remote host.
1021 The initial value for the suspend character is taken to be
1022 the terminal's
1023 .Ic suspend
1024 character.
1025 .It Ic tracefile
1026 This is the file to which the output, caused by
1027 .Ic netdata
1028 or
1029 .Ic option
1030 tracing being
1031 .Dv TRUE ,
1032 will be written.  If it is set to
1033 .Dq Fl ,
1034 then tracing information will be written to standard output (the default).
1035 .It Ic worderase
1036 If
1037 .Nm
1038 is operating in
1039 .Dv LINEMODE
1040 or \*(Lqold line by line\*(Rq mode, then this character is taken to
1041 be the terminal's
1042 .Ic worderase
1043 character.
1044 The initial value for the worderase character is taken to be
1045 the terminal's
1046 .Ic worderase
1047 character.
1048 .It Ic ?\&
1049 Displays the legal
1050 .Ic set
1051 .Pq Ic unset
1052 commands.
1053 .El
1054 .It Ic opie Ar sequence challenge
1055 The
1056 .Ic opie
1057 command computes a response to the OPIE challenge.
1058 .It Ic slc Ar state
1059 The
1060 .Ic slc
1061 command (Set Local Characters) is used to set
1062 or change the state of the special
1063 characters when the
1064 .Dv TELNET LINEMODE
1065 option has
1066 been enabled.  Special characters are characters that get
1067 mapped to
1068 .Tn TELNET
1069 commands sequences (like
1070 .Ic ip
1071 or
1072 .Ic quit  )
1073 or line editing characters (like
1074 .Ic erase
1075 and
1076 .Ic kill  ) .
1077 By default, the local special characters are exported.
1078 .Bl -tag -width Fl
1079 .It Ic check
1080 Verify the current settings for the current special characters.
1081 The remote side is requested to send all the current special
1082 character settings, and if there are any discrepancies with
1083 the local side, the local side will switch to the remote value.
1084 .It Ic export
1085 Switch to the local defaults for the special characters.  The
1086 local default characters are those of the local terminal at
1087 the time when
1088 .Nm
1089 was started.
1090 .It Ic import
1091 Switch to the remote defaults for the special characters.
1092 The remote default characters are those of the remote system
1093 at the time when the
1094 .Tn TELNET
1095 connection was established.
1096 .It Ic ?\&
1097 Prints out help information for the
1098 .Ic slc
1099 command.
1100 .El
1101 .It Ic status
1102 Show the current status of
1103 .Nm .
1104 This includes the peer one is connected to, as well
1105 as the current mode.
1106 .It Ic toggle Ar arguments ...
1107 Toggle (between
1108 .Dv TRUE
1109 and
1110 .Dv FALSE )
1111 various flags that control how
1112 .Nm
1113 responds to events.
1114 These flags may be set explicitly to
1115 .Dv TRUE
1116 or
1117 .Dv FALSE
1118 using the
1119 .Ic set
1120 and
1121 .Ic unset
1122 commands listed above.
1123 More than one argument may be specified.
1124 The state of these flags may be interrogated with the
1125 .Ic display
1126 command.
1127 Valid arguments are:
1128 .Bl -tag -width Ar
1129 .It Ic authdebug
1130 Turns on debugging information for the authentication code.
1131 .It Ic autoflush
1132 If
1133 .Ic autoflush
1134 and
1135 .Ic localchars
1136 are both
1137 .Dv TRUE ,
1138 then when the
1139 .Ic ao  ,
1140 or
1141 .Ic quit
1142 characters are recognized (and transformed into
1143 .Tn TELNET
1144 sequences; see
1145 .Ic set
1146 above for details),
1147 .Nm
1148 refuses to display any data on the user's terminal
1149 until the remote system acknowledges (via a
1150 .Dv TELNET TIMING MARK
1151 option)
1152 that it has processed those
1153 .Tn TELNET
1154 sequences.
1155 The initial value for this toggle is
1156 .Dv TRUE
1157 if the terminal user had not
1158 done an "stty noflsh", otherwise
1159 .Dv FALSE
1160 (see
1161 .Xr stty  1  ) .
1162 .It Ic autodecrypt
1163 When the
1164 .Dv TELNET ENCRYPT
1165 option is negotiated, by
1166 default the actual encryption (decryption) of the data
1167 stream does not start automatically.  The autoencrypt
1168 (autodecrypt) command states that encryption of the
1169 output (input) stream should be enabled as soon as
1170 possible.
1171 .It Ic autologin
1172 If the remote side supports the
1173 .Dv TELNET AUTHENTICATION
1174 option
1175 .Nm
1176 attempts to use it to perform automatic authentication.  If the
1177 .Dv AUTHENTICATION
1178 option is not supported, the user's login
1179 name are propagated through the
1180 .Dv TELNET ENVIRON
1181 option.
1182 This command is the same as specifying
1183 .Fl a
1184 option on the
1185 .Ic open
1186 command.
1187 .It Ic autosynch
1188 If
1189 .Ic autosynch
1190 and
1191 .Ic localchars
1192 are both
1193 .Dv TRUE ,
1194 then when either the
1195 .Ic intr
1196 or
1197 .Ic quit
1198 characters is typed (see
1199 .Ic set
1200 above for descriptions of the
1201 .Ic intr
1202 and
1203 .Ic quit
1204 characters), the resulting
1205 .Tn TELNET
1206 sequence sent is followed by the
1207 .Dv TELNET SYNCH
1208 sequence.
1209 This procedure
1210 .Ic should
1211 cause the remote system to begin throwing away all previously
1212 typed input until both of the
1213 .Tn TELNET
1214 sequences have been read and acted upon.
1215 The initial value of this toggle is
1216 .Dv FALSE .
1217 .It Ic binary
1218 Enable or disable the
1219 .Dv TELNET BINARY
1220 option on both input and output.
1221 .It Ic inbinary
1222 Enable or disable the
1223 .Dv TELNET BINARY
1224 option on input.
1225 .It Ic outbinary
1226 Enable or disable the
1227 .Dv TELNET BINARY
1228 option on output.
1229 .It Ic crlf
1230 If this is
1231 .Dv TRUE ,
1232 then carriage returns will be sent as
1233 .Li <CR><LF> .
1234 If this is
1235 .Dv FALSE ,
1236 then carriage returns will be send as
1237 .Li <CR><NUL> .
1238 The initial value for this toggle is
1239 .Dv FALSE .
1240 .It Ic crmod
1241 Toggle carriage return mode.
1242 When this mode is enabled, most carriage return characters received from
1243 the remote host will be mapped into a carriage return followed by
1244 a line feed.
1245 This mode does not affect those characters typed by the user, only
1246 those received from the remote host.
1247 This mode is not very useful unless the remote host
1248 only sends carriage return, but never line feed.
1249 The initial value for this toggle is
1250 .Dv FALSE .
1251 .It Ic debug
1252 Toggles socket level debugging (useful only to the
1253 .Ic super user  ) .
1254 The initial value for this toggle is
1255 .Dv FALSE .
1256 .It Ic encdebug
1257 Turns on debugging information for the encryption code.
1258 .It Ic localchars
1259 If this is
1260 .Dv TRUE ,
1261 then the
1262 .Ic flush  ,
1263 .Ic interrupt ,
1264 .Ic quit  ,
1265 .Ic erase ,
1266 and
1267 .Ic kill
1268 characters (see
1269 .Ic set
1270 above) are recognized locally, and transformed into (hopefully) appropriate
1271 .Tn TELNET
1272 control sequences
1273 (respectively
1274 .Ic ao  ,
1275 .Ic ip ,
1276 .Ic brk  ,
1277 .Ic ec ,
1278 and
1279 .Ic el  ;
1280 see
1281 .Ic send
1282 above).
1283 The initial value for this toggle is
1284 .Dv TRUE
1285 in \*(Lqold line by line\*(Rq mode,
1286 and
1287 .Dv FALSE
1288 in \*(Lqcharacter at a time\*(Rq mode.
1289 When the
1290 .Dv LINEMODE
1291 option is enabled, the value of
1292 .Ic localchars
1293 is ignored, and assumed to always be
1294 .Dv TRUE .
1295 If
1296 .Dv LINEMODE
1297 has ever been enabled, then
1298 .Ic quit
1299 is sent as
1300 .Ic abort  ,
1301 and
1302 .Ic eof
1303 and
1304 .Ic suspend
1305 are sent as
1306 .Ic eof
1307 and
1308 .Ic susp
1309 (see
1310 .Ic send
1311 above).
1312 .It Ic netdata
1313 Toggles the display of all network data (in hexadecimal format).
1314 The initial value for this toggle is
1315 .Dv FALSE .
1316 .It Ic options
1317 Toggles the display of some internal
1318 .Nm
1319 protocol processing (having to do with
1320 .Tn TELNET
1321 options).
1322 The initial value for this toggle is
1323 .Dv FALSE .
1324 .It Ic prettydump
1325 When the
1326 .Ic netdata
1327 toggle is enabled, if
1328 .Ic prettydump
1329 is enabled the output from the
1330 .Ic netdata
1331 command will be formatted in a more user readable format.
1332 Spaces are put between each character in the output, and the
1333 beginning of any
1334 .Nm
1335 escape sequence is preceded by a '*' to aid in locating them.
1336 .It Ic skiprc
1337 When the skiprc toggle is
1338 .Dv TRUE ,
1339 .Nm
1340 skips the reading of the
1341 .Pa \&.telnetrc
1342 file in the users home
1343 directory when connections are opened.  The initial
1344 value for this toggle is
1345 .Dv FALSE .
1346 .It Ic termdata
1347 Toggles the display of all terminal data (in hexadecimal format).
1348 The initial value for this toggle is
1349 .Dv FALSE .
1350 .It Ic verbose_encrypt
1351 When the
1352 .Ic verbose_encrypt
1353 toggle is
1354 .Dv TRUE ,
1355 .Nm
1356 prints out a message each time encryption is enabled or
1357 disabled.  The initial value for this toggle is
1358 .Dv FALSE .
1359 .It Ic ?\&
1360 Displays the legal
1361 .Ic toggle
1362 commands.
1363 .El
1364 .It Ic z
1365 Suspend
1366 .Nm .
1367 This command only works when the user is using the
1368 .Xr csh  1  .
1369 .It Ic \&! Op Ar command
1370 Execute a single command in a subshell on the local
1371 system.  If
1372 .Ar command
1373 is omitted, then an interactive
1374 subshell is invoked.
1375 .It Ic ?\& Op Ar command
1376 Get help.  With no arguments,
1377 .Nm
1378 prints a help summary.
1379 If
1380 .Ar command
1381 is specified,
1382 .Nm
1383 will print the help information for just that command.
1384 .El
1385 .Sh ENVIRONMENT
1386 .Nm
1387 uses at least the
1388 .Ev HOME ,
1389 .Ev SHELL ,
1390 .Ev DISPLAY ,
1391 and
1392 .Ev TERM
1393 environment variables.
1394 Other environment variables may be propagated
1395 to the other side via the
1396 .Dv TELNET ENVIRON
1397 option.
1398 .Sh SEE ALSO
1399 .Xr rlogin 1 ,
1400 .Xr rsh 1 ,
1401 .Xr hosts 5 ,
1402 .Xr nologin 5 ,
1403 .Xr telnetd 8
1404 .Sh FILES
1405 .Bl -tag -width ~/.telnetrc -compact
1406 .It Pa ~/.telnetrc
1407 user customized telnet startup values
1408 .El
1409 .Sh HISTORY
1410 The
1411 .Nm
1412 command appeared in
1413 .Bx 4.2 .
1414 .Pp
1415 IPv6 support was added by WIDE/KAME project.
1416 .Sh NOTES
1417 On some remote systems, echo has to be turned off manually when in
1418 \*(Lqold line by line\*(Rq mode.
1419 .Pp
1420 In \*(Lqold line by line\*(Rq mode or
1421 .Dv LINEMODE
1422 the terminal's
1423 .Ic eof
1424 character is only recognized (and sent to the remote system)
1425 when it is the first character on a line.