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