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