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