*** empty log message ***
[heimdal.git] / appl / telnet / telnet / telnet.1
blob2b3198ec110ae2b0233fe17bb2b27107aabe4023
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.
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
135 .Nm telnet
136 escape character to
137 .Ar escape char.
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 .ne 1i
147 .It Fl k Ar realm
148 If Kerberos authentication is being used, the
149 .Fl k
150 option requests that telnet obtain tickets for the remote host in
151 realm realm instead of the remote host's realm, as determined
153 .Xr krb_realmofhost 3 .
154 .It Fl l Ar user 
155 When connecting to the remote system, if the remote system
156 understands the
157 .Ev ENVIRON
158 option, then
159 .Ar user
160 will be sent to the remote system as the value for the variable USER.
161 This option implies the
162 .Fl a
163 option.
164 This option may also be used with the
165 .Ic open
166 command.
167 .It Fl n Ar tracefile 
168 Opens
169 .Ar tracefile
170 for recording trace information.
171 See the
172 .Ic set tracefile
173 command below.
174 .It Fl r
175 Specifies a user interface similar to
176 .Xr rlogin 1 .
177 In this
178 mode, the escape character is set to the tilde (~) character,
179 unless modified by the -e option.
180 .It Fl x
181 Turns on encryption of the data stream if possible. This is 
182 currently the default and when it fails a warning is issued.
183 .It Ar host
184 Indicates the official name, an alias, or the Internet address
185 of a remote host.
186 .It Ar port
187 Indicates a port number (address of an application).  If a number is
188 not specified, the default
189 .Nm telnet
190 port is used.
193 When in rlogin mode, a line of the form ~.  disconnects from the
194 remote host; ~ is the telnet escape character.
195 Similarly, the line ~^Z suspends the telnet session.
196 The line ~^] escapes to the normal telnet escape prompt.
198 Once a connection has been opened,
199 .Nm telnet
200 will attempt to enable the
201 .Dv TELNET LINEMODE
202 option.
203 If this fails, then
204 .Nm telnet
205 will revert to one of two input modes:
206 either \*(Lqcharacter at a time\*(Rq
207 or \*(Lqold line by line\*(Rq
208 depending on what the remote system supports.
210 When 
211 .Dv LINEMODE
212 is enabled, character processing is done on the
213 local system, under the control of the remote system.  When input
214 editing or character echoing is to be disabled, the remote system
215 will relay that information.  The remote system will also relay
216 changes to any special characters that happen on the remote
217 system, so that they can take effect on the local system.
219 In \*(Lqcharacter at a time\*(Rq mode, most
220 text typed is immediately sent to the remote host for processing.
222 In \*(Lqold line by line\*(Rq mode, all text is echoed locally,
223 and (normally) only completed lines are sent to the remote host.
224 The \*(Lqlocal echo character\*(Rq (initially \*(Lq^E\*(Rq) may be used
225 to turn off and on the local echo
226 (this would mostly be used to enter passwords
227 without the password being echoed).
229 If the 
230 .Dv LINEMODE
231 option is enabled, or if the
232 .Ic localchars
233 toggle is
234 .Dv TRUE
235 (the default for \*(Lqold line by line\*(Lq; see below),
236 the user's
237 .Ic quit  ,
238 .Ic intr ,
240 .Ic flush
241 characters are trapped locally, and sent as
242 .Tn TELNET
243 protocol sequences to the remote side.
244 If 
245 .Dv LINEMODE
246 has ever been enabled, then the user's
247 .Ic susp
249 .Ic eof
250 are also sent as
251 .Tn TELNET
252 protocol sequences,
254 .Ic quit
255 is sent as a 
256 .Dv TELNET ABORT
257 instead of 
258 .Dv BREAK
259 There are options (see
260 .Ic toggle
261 .Ic autoflush
263 .Ic toggle
264 .Ic autosynch
265 below)
266 which cause this action to flush subsequent output to the terminal
267 (until the remote host acknowledges the
268 .Tn TELNET
269 sequence) and flush previous terminal input
270 (in the case of
271 .Ic quit
273 .Ic intr  ) .
275 While connected to a remote host,
276 .Nm telnet
277 command mode may be entered by typing the
278 .Nm telnet
279 \*(Lqescape character\*(Rq (initially \*(Lq^]\*(Rq).
280 When in command mode, the normal terminal editing conventions are available.
282 The following
283 .Nm telnet
284 commands are available.
285 Only enough of each command to uniquely identify it need be typed
286 (this is also true for arguments to the
287 .Ic mode  ,
288 .Ic set ,
289 .Ic toggle  ,
290 .Ic unset ,
291 .Ic slc  ,
292 .Ic environ ,
294 .Ic display
295 commands).
297 .Bl -tag -width "mode type"
298 .It Ic auth Ar argument ... 
299 The auth command manipulates the information sent through the
300 .Dv TELNET AUTHENTICATE
301 option.  Valid arguments for the
302 auth command are as follows:
303 .Bl -tag -width "disable type"
304 .It Ic disable Ar type
305 Disables the specified type of authentication.  To
306 obtain a list of available types, use the
307 .Ic auth disable \&?
308 command.
309 .It Ic enable Ar type
310 Enables the specified type of authentication.  To
311 obtain a list of available types, use the
312 .Ic auth enable \&?
313 command.
314 .It Ic status
315 Lists the current status of the various types of
316 authentication.
318 .It Ic close
319 Close a
320 .Tn TELNET
321 session and return to command mode.
322 .It Ic display Ar argument ... 
323 Displays all, or some, of the
324 .Ic set
326 .Ic toggle
327 values (see below).
328 .It Ic encrypt Ar argument ...
329 The encrypt command manipulates the information sent through the
330 .Dv TELNET ENCRYPT
331 option.
333 Note:  Because of export controls, the
334 .Dv TELNET ENCRYPT
335 option is not supported outside of the United States and Canada.
337 Valid arguments for the encrypt command are as follows:
338 .Bl -tag -width Ar
339 .It Ic disable Ar type Ic [input|output]
340 Disables the specified type of encryption.  If you
341 omit the input and output, both input and output
342 are disabled.  To obtain a list of available
343 types, use the
344 .Ic encrypt disable \&?
345 command.
346 .It Ic enable Ar type Ic [input|output]
347 Enables the specified type of encryption.  If you
348 omit input and output, both input and output are
349 enabled.  To obtain a list of available types, use the
350 .Ic encrypt enable \&?
351 command.
352 .It Ic input
353 This is the same as the
354 .Ic encrypt start input
355 command.
356 .It Ic -input
357 This is the same as the
358 .Ic encrypt stop input
359 command.
360 .It Ic output
361 This is the same as the
362 .Ic encrypt start output
363 command.
364 .It Ic -output
365 This is the same as the
366 .Ic encrypt stop output
367 command.
368 .It Ic start Ic [input|output]
369 Attempts to start encryption.  If you omit
370 .Ic input
372 .Ic output,
373 both input and output are enabled.  To
374 obtain a list of available types, use the
375 .Ic encrypt enable \&?
376 command.
377 .It Ic status
378 Lists the current status of encryption.
379 .It Ic stop Ic [input|output]
380 Stops encryption.  If you omit input and output,
381 encryption is on both input and output.
382 .It Ic type Ar type
383 Sets the default type of encryption to be used
384 with later
385 .Ic encrypt start
387 .Ic encrypt stop
388 commands.
390 .It Ic environ Ar arguments... 
392 .Ic environ
393 command is used to manipulate the
394 the variables that my be sent through the
395 .Dv TELNET ENVIRON
396 option.
397 The initial set of variables is taken from the users
398 environment, with only the
399 .Ev DISPLAY
401 .Ev PRINTER
402 variables being exported by default.
404 .Ev USER
405 variable is also exported if the
406 .Fl a
408 .Fl l
409 options are used.
411 Valid arguments for the
412 .Ic environ
413 command are:
414 .Bl -tag -width Fl
415 .It Ic define Ar variable value 
416 Define the variable
417 .Ar variable
418 to have a value of
419 .Ar value.
420 Any variables defined by this command are automatically exported.
422 .Ar value
423 may be enclosed in single or double quotes so
424 that tabs and spaces may be included.
425 .It Ic undefine Ar variable 
426 Remove
427 .Ar variable
428 from the list of environment variables.
429 .It Ic export Ar variable 
430 Mark the variable
431 .Ar variable
432 to be exported to the remote side.
433 .It Ic unexport Ar variable 
434 Mark the variable
435 .Ar variable
436 to not be exported unless
437 explicitly asked for by the remote side.
438 .It Ic list
439 List the current set of environment variables.
440 Those marked with a
441 .Cm *
442 will be sent automatically,
443 other variables will only be sent if explicitly requested.
444 .It Ic \&?
445 Prints out help information for the
446 .Ic environ
447 command.
449 .It Ic logout
450 Sends the
451 .Dv TELNET LOGOUT
452 option to the remote side.
453 This command is similar to a
454 .Ic close
455 command; however, if the remote side does not support the
456 .Dv LOGOUT
457 option, nothing happens.
458 If, however, the remote side does support the
459 .Dv LOGOUT
460 option, this command should cause the remote side to close the
461 .Tn TELNET
462 connection.
463 If the remote side also supports the concept of
464 suspending a user's session for later reattachment,
465 the logout argument indicates that you
466 should terminate the session immediately.
467 .It Ic mode Ar type 
468 .Ar Type
469 is one of several options, depending on the state of the
470 .Tn TELNET
471 session.
472 The remote host is asked for permission to go into the requested mode.
473 If the remote host is capable of entering that mode, the requested
474 mode will be entered.
475 .Bl -tag -width Ar
476 .It Ic character
477 Disable the
478 .Dv TELNET LINEMODE
479 option, or, if the remote side does not understand the
480 .Dv LINEMODE
481 option, then enter \*(Lqcharacter at a time\*(Lq mode.
482 .It Ic line
483 Enable the
484 .Dv TELNET LINEMODE
485 option, or, if the remote side does not understand the
486 .Dv LINEMODE
487 option, then attempt to enter \*(Lqold-line-by-line\*(Lq mode.
488 .It Ic isig Pq Ic \-isig 
489 Attempt to enable (disable) the 
490 .Dv TRAPSIG
491 mode of the 
492 .Dv LINEMODE
493 option.
494 This requires that the 
495 .Dv LINEMODE
496 option be enabled.
497 .It Ic edit Pq Ic \-edit 
498 Attempt to enable (disable) the 
499 .Dv EDIT
500 mode of the 
501 .Dv LINEMODE
502 option.
503 This requires that the 
504 .Dv LINEMODE
505 option be enabled.
506 .It Ic softtabs Pq Ic \-softtabs 
507 Attempt to enable (disable) the 
508 .Dv SOFT_TAB
509 mode of the 
510 .Dv LINEMODE
511 option.
512 This requires that the 
513 .Dv LINEMODE
514 option be enabled.
515 .ne 1i
516 .It Ic litecho Pq Ic \-litecho 
517 Attempt to enable (disable) the 
518 .Dv LIT_ECHO
519 mode of the 
520 .Dv LINEMODE
521 option.
522 This requires that the 
523 .Dv LINEMODE
524 option be enabled.
525 .It Ic \&?
526 Prints out help information for the
527 .Ic mode
528 command.
530 .It Xo
531 .Ic open Ar host
532 .Oo Op Fl l
533 .Ar user
534 .Oc Ns Oo Fl
535 .Ar port Oc
537 Open a connection to the named host.
538 If no port number
539 is specified,
540 .Nm telnet
541 will attempt to contact a
542 .Tn TELNET
543 server at the default port.
544 The host specification may be either a host name (see
545 .Xr hosts  5  )
546 or an Internet address specified in the \*(Lqdot notation\*(Rq (see
547 .Xr inet 3 ) .
549 .Op Fl l
550 option may be used to specify the user name
551 to be passed to the remote system via the
552 .Ev ENVIRON
553 option.
554 When connecting to a non-standard port,
555 .Nm telnet
556 omits any automatic initiation of
557 .Tn TELNET
558 options.  When the port number is preceded by a minus sign,
559 the initial option negotiation is done.
560 After establishing a connection, the file
561 .Pa \&.telnetrc
562 in the
563 users home directory is opened.  Lines beginning with a # are
564 comment lines.  Blank lines are ignored.  Lines that begin
565 without white space are the start of a machine entry.  The
566 first thing on the line is the name of the machine that is
567 being connected to.  The rest of the line, and successive
568 lines that begin with white space are assumed to be
569 .Nm telnet
570 commands and are processed as if they had been typed
571 in manually to the
572 .Nm telnet
573 command prompt.
574 .It Ic quit
575 Close any open
576 .Tn TELNET
577 session and exit
578 .Nm telnet  .
579 An end of file (in command mode) will also close a session and exit.
580 .It Ic send Ar arguments 
581 Sends one or more special character sequences to the remote host.
582 The following are the arguments which may be specified
583 (more than one argument may be specified at a time):
585 .Bl -tag -width escape
586 .It Ic abort
587 Sends the
588 .Dv TELNET ABORT
589 (Abort
590 processes)
591 sequence.
592 .It Ic ao
593 Sends the
594 .Dv TELNET AO
595 (Abort Output) sequence, which should cause the remote system to flush
596 all output
597 .Em from
598 the remote system
599 .Em to
600 the user's terminal.
601 .It Ic ayt
602 Sends the
603 .Dv TELNET AYT
604 (Are You There)
605 sequence, to which the remote system may or may not choose to respond.
606 .It Ic brk
607 Sends the
608 .Dv TELNET BRK
609 (Break) sequence, which may have significance to the remote
610 system.
611 .It Ic ec
612 Sends the
613 .Dv TELNET EC
614 (Erase Character)
615 sequence, which should cause the remote system to erase the last character
616 entered.
617 .It Ic el
618 Sends the
619 .Dv TELNET EL
620 (Erase Line)
621 sequence, which should cause the remote system to erase the line currently
622 being entered.
623 .It Ic eof
624 Sends the
625 .Dv TELNET EOF
626 (End Of File)
627 sequence.
628 .It Ic eor
629 Sends the
630 .Dv TELNET EOR
631 (End of Record)
632 sequence.
633 .It Ic escape
634 Sends the current
635 .Nm telnet
636 escape character (initially \*(Lq^\*(Rq).
637 .It Ic ga
638 Sends the
639 .Dv TELNET GA
640 (Go Ahead)
641 sequence, which likely has no significance to the remote system.
642 .It Ic getstatus
643 If the remote side supports the
644 .Dv TELNET STATUS
645 command,
646 .Ic getstatus
647 will send the subnegotiation to request that the server send
648 its current option status.
649 .ne 1i
650 .It Ic ip
651 Sends the
652 .Dv TELNET IP
653 (Interrupt Process) sequence, which should cause the remote
654 system to abort the currently running process.
655 .It Ic nop
656 Sends the
657 .Dv TELNET NOP
658 (No OPeration)
659 sequence.
660 .It Ic susp
661 Sends the
662 .Dv TELNET SUSP
663 (SUSPend process)
664 sequence.
665 .It Ic synch
666 Sends the
667 .Dv TELNET SYNCH
668 sequence.
669 This sequence causes the remote system to discard all previously typed
670 (but not yet read) input.
671 This sequence is sent as
672 .Tn TCP
673 urgent
674 data (and may not work if the remote system is a
675 .Bx 4.2
676 system -- if
677 it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal).
678 .It Ic do Ar cmd
679 .It Ic dont Ar cmd
680 .It Ic will Ar cmd
681 .It Ic wont Ar cmd
682 Sends the
683 .Dv TELNET DO
684 .Ar cmd
685 sequence.
686 .Ar Cmd
687 can be either a decimal number between 0 and 255,
688 or a symbolic name for a specific
689 .Dv TELNET
690 command.
691 .Ar Cmd
692 can also be either
693 .Ic help
695 .Ic \&?
696 to print out help information, including
697 a list of known symbolic names.
698 .It Ic \&?
699 Prints out help information for the
700 .Ic send
701 command.
703 .It Ic set Ar argument value 
704 .It Ic unset Ar argument value 
706 .Ic set
707 command will set any one of a number of
708 .Nm telnet
709 variables to a specific value or to
710 .Dv TRUE .
711 The special value
712 .Ic off
713 turns off the function associated with
714 the variable, this is equivalent to using the
715 .Ic unset
716 command.
718 .Ic unset
719 command will disable or set to
720 .Dv FALSE
721 any of the specified functions.
722 The values of variables may be interrogated with the
723 .Ic display
724 command.
725 The variables which may be set or unset, but not toggled, are
726 listed here.  In addition, any of the variables for the
727 .Ic toggle
728 command may be explicitly set or unset using
730 .Ic set
732 .Ic unset
733 commands.
734 .Bl -tag -width escape
735 .It Ic ayt
737 .Tn TELNET
738 is in localchars mode, or
739 .Dv LINEMODE
740 is enabled, and the status character is typed, a
741 .Dv TELNET AYT
742 sequence (see
743 .Ic send ayt
744 preceding) is sent to the
745 remote host.  The initial value for the "Are You There"
746 character is the terminal's status character.
747 .It Ic echo
748 This is the value (initially \*(Lq^E\*(Rq) which, when in
749 \*(Lqline by line\*(Rq mode, toggles between doing local echoing
750 of entered characters (for normal processing), and suppressing
751 echoing of entered characters (for entering, say, a password).
752 .It Ic eof
754 .Nm telnet
755 is operating in
756 .Dv LINEMODE
757 or \*(Lqold line by line\*(Rq mode, entering this character
758 as the first character on a line will cause this character to be
759 sent to the remote system.
760 The initial value of the eof character is taken to be the terminal's
761 .Ic eof
762 character.
763 .It Ic erase
765 .Nm telnet
766 is in
767 .Ic localchars
768 mode (see
769 .Ic toggle
770 .Ic localchars
771 below),
772 .Sy and
774 .Nm telnet
775 is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
776 character is typed, a
777 .Dv TELNET EC
778 sequence (see
779 .Ic send
780 .Ic ec
781 above)
782 is sent to the remote system.
783 The initial value for the erase character is taken to be
784 the terminal's
785 .Ic erase
786 character.
787 .It Ic escape
788 This is the
789 .Nm telnet
790 escape character (initially \*(Lq^[\*(Rq) which causes entry
791 into
792 .Nm telnet
793 command mode (when connected to a remote system).
794 .It Ic flushoutput
796 .Nm telnet
797 is in
798 .Ic localchars
799 mode (see
800 .Ic toggle
801 .Ic localchars
802 below)
803 and the
804 .Ic flushoutput
805 character is typed, a
806 .Dv TELNET AO
807 sequence (see
808 .Ic send
809 .Ic ao
810 above)
811 is sent to the remote host.
812 The initial value for the flush character is taken to be
813 the terminal's
814 .Ic flush
815 character.
816 .It Ic forw1
817 .It Ic forw2
819 .Tn TELNET
820 is operating in
821 .Dv LINEMODE ,
822 these are the
823 characters that, when typed, cause partial lines to be
824 forwarded to the remote system.  The initial value for
825 the forwarding characters are taken from the terminal's
826 eol and eol2 characters.
827 .It Ic interrupt
829 .Nm telnet
830 is in
831 .Ic localchars
832 mode (see
833 .Ic toggle
834 .Ic localchars
835 below)
836 and the
837 .Ic interrupt
838 character is typed, a
839 .Dv TELNET IP
840 sequence (see
841 .Ic send
842 .Ic ip
843 above)
844 is sent to the remote host.
845 The initial value for the interrupt character is taken to be
846 the terminal's
847 .Ic intr
848 character.
849 .It Ic kill
851 .Nm telnet
852 is in
853 .Ic localchars
854 mode (see
855 .Ic toggle
856 .Ic localchars
857 below),
858 .Ic and
860 .Nm telnet
861 is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
862 character is typed, a
863 .Dv TELNET EL
864 sequence (see
865 .Ic send
866 .Ic el
867 above)
868 is sent to the remote system.
869 The initial value for the kill character is taken to be
870 the terminal's
871 .Ic kill
872 character.
873 .It Ic lnext
875 .Nm telnet
876 is operating in
877 .Dv LINEMODE
878 or \*(Lqold line by line\*(Lq mode, then this character is taken to
879 be the terminal's
880 .Ic lnext
881 character.
882 The initial value for the lnext character is taken to be
883 the terminal's
884 .Ic lnext
885 character.
886 .It Ic quit
888 .Nm telnet
889 is in
890 .Ic localchars
891 mode (see
892 .Ic toggle
893 .Ic localchars
894 below)
895 and the
896 .Ic quit
897 character is typed, a
898 .Dv TELNET BRK
899 sequence (see
900 .Ic send
901 .Ic brk
902 above)
903 is sent to the remote host.
904 The initial value for the quit character is taken to be
905 the terminal's
906 .Ic quit
907 character.
908 .It Ic reprint
910 .Nm telnet
911 is operating in
912 .Dv LINEMODE
913 or \*(Lqold line by line\*(Lq mode, then this character is taken to
914 be the terminal's
915 .Ic reprint
916 character.
917 The initial value for the reprint character is taken to be
918 the terminal's
919 .Ic reprint
920 character.
921 .It Ic rlogin
922 This is the rlogin escape character.
923 If set, the normal
924 .Tn TELNET
925 escape character is ignored unless it is
926 preceded by this character at the beginning of a line.
927 This character, at the beginning of a line followed by
928 a "."  closes the connection; when followed by a ^Z it
929 suspends the telnet command.  The initial state is to
930 disable the rlogin escape character.
931 .It Ic start
932 If the
933 .Dv TELNET TOGGLE-FLOW-CONTROL
934 option has been enabled,
935 then this character is taken to
936 be the terminal's
937 .Ic start
938 character.
939 The initial value for the kill character is taken to be
940 the terminal's
941 .Ic start
942 character.
943 .It Ic stop
944 If the
945 .Dv TELNET TOGGLE-FLOW-CONTROL
946 option has been enabled,
947 then this character is taken to
948 be the terminal's
949 .Ic stop
950 character.
951 The initial value for the kill character is taken to be
952 the terminal's
953 .Ic stop
954 character.
955 .It Ic susp
957 .Nm telnet
958 is in
959 .Ic localchars
960 mode, or
961 .Dv LINEMODE
962 is enabled, and the
963 .Ic suspend
964 character is typed, a
965 .Dv TELNET SUSP
966 sequence (see
967 .Ic send
968 .Ic susp
969 above)
970 is sent to the remote host.
971 The initial value for the suspend character is taken to be
972 the terminal's
973 .Ic suspend
974 character.
975 .ne 1i
976 .It Ic tracefile
977 This is the file to which the output, caused by
978 .Ic netdata
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
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.
1005 .It Ic slc Ar state 
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
1019 .Ic quit  )
1020 or line editing characters (like
1021 .Ic erase
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.
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
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
1064 .Dv FALSE
1065 using the
1066 .Ic set
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
1080 .Ic autoflush
1082 .Ic localchars
1083 are both
1084 .Dv TRUE ,
1085 then when the
1086 .Ic ao  ,
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.
1120 Note:  Because of export controls, the
1121 .Dv TELNET ENCRYPT
1122 option is not supported outside the United States and Canada.
1123 .It Ic autologin
1124 If the remote side supports the
1125 .Dv TELNET AUTHENTICATION
1126 option
1127 .Tn TELNET
1128 attempts to use it to perform automatic authentication.  If the
1129 .Dv AUTHENTICATION
1130 option is not supported, the user's login
1131 name are propagated through the
1132 .Dv TELNET ENVIRON
1133 option.
1134 This command is the same as specifying
1135 .Ar a
1136 option on the
1137 .Ic open
1138 command.
1139 .It Ic autosynch
1141 .Ic autosynch
1143 .Ic localchars
1144 are both
1145 .Dv TRUE ,
1146 then when either the
1147 .Ic intr
1149 .Ic quit
1150 characters is typed (see
1151 .Ic set
1152 above for descriptions of the
1153 .Ic intr
1155 .Ic quit
1156 characters), the resulting
1157 .Tn TELNET
1158 sequence sent is followed by the
1159 .Dv TELNET SYNCH
1160 sequence.
1161 This procedure
1162 .Ic should
1163 cause the remote system to begin throwing away all previously
1164 typed input until both of the
1165 .Tn TELNET
1166 sequences have been read and acted upon.
1167 The initial value of this toggle is
1168 .Dv FALSE .
1169 .It Ic binary
1170 Enable or disable the
1171 .Dv TELNET BINARY
1172 option on both input and output.
1173 .It Ic inbinary
1174 Enable or disable the
1175 .Dv TELNET BINARY
1176 option on input.
1177 .It Ic outbinary
1178 Enable or disable the
1179 .Dv TELNET BINARY
1180 option on output.
1181 .It Ic crlf
1182 If this is
1183 .Dv TRUE ,
1184 then carriage returns will be sent as
1185 .Li <CR><LF> .
1186 If this is
1187 .Dv FALSE ,
1188 then carriage returns will be send as
1189 .Li <CR><NUL> .
1190 The initial value for this toggle is
1191 .Dv FALSE .
1192 .It Ic crmod
1193 Toggle carriage return mode.
1194 When this mode is enabled, most carriage return characters received from
1195 the remote host will be mapped into a carriage return followed by
1196 a line feed.
1197 This mode does not affect those characters typed by the user, only
1198 those received from the remote host.
1199 This mode is not very useful unless the remote host
1200 only sends carriage return, but never line feed.
1201 The initial value for this toggle is
1202 .Dv FALSE .
1203 .It Ic debug
1204 Toggles socket level debugging (useful only to the
1205 .Ic super user  ) .
1206 The initial value for this toggle is
1207 .Dv FALSE .
1208 .It Ic encdebug
1209 Turns on debugging information for the encryption code.
1210 .It Ic localchars
1211 If this is
1212 .Dv TRUE ,
1213 then the
1214 .Ic flush  ,
1215 .Ic interrupt ,
1216 .Ic quit  ,
1217 .Ic erase ,
1219 .Ic kill
1220 characters (see
1221 .Ic set
1222 above) are recognized locally, and transformed into (hopefully) appropriate
1223 .Tn TELNET
1224 control sequences
1225 (respectively
1226 .Ic ao  ,
1227 .Ic ip ,
1228 .Ic brk  ,
1229 .Ic ec ,
1231 .Ic el  ;
1233 .Ic send
1234 above).
1235 The initial value for this toggle is
1236 .Dv TRUE
1237 in \*(Lqold line by line\*(Rq mode,
1239 .Dv FALSE
1240 in \*(Lqcharacter at a time\*(Rq mode.
1241 When the
1242 .Dv LINEMODE
1243 option is enabled, the value of
1244 .Ic localchars
1245 is ignored, and assumed to always be
1246 .Dv TRUE .
1248 .Dv LINEMODE
1249 has ever been enabled, then
1250 .Ic quit
1251 is sent as
1252 .Ic abort  ,
1254 .Ic eof and
1255 .B suspend
1256 are sent as
1257 .Ic eof and
1258 .Ic susp ,
1260 .Ic send
1261 above).
1262 .It Ic netdata
1263 Toggles the display of all network data (in hexadecimal format).
1264 The initial value for this toggle is
1265 .Dv FALSE .
1266 .It Ic options
1267 Toggles the display of some internal
1268 .Nm telnet
1269 protocol processing (having to do with
1270 .Tn TELNET
1271 options).
1272 The initial value for this toggle is
1273 .Dv FALSE .
1274 .ne 1i
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.
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.
1336 .Sh ENVIRONMENT
1337 .Nm Telnet
1338 uses at least the
1339 .Ev HOME ,
1340 .Ev SHELL ,
1341 .Ev DISPLAY ,
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
1354 .Sh HISTORY
1356 .Nm Telnet
1357 command appeared in
1358 .Bx 4.2 .
1359 .Sh NOTES
1361 On some remote systems, echo has to be turned off manually when in
1362 \*(Lqold line by line\*(Rq mode.
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.