649845f8ced814ec0cf38af35a6440bc28fbdc27
[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. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)telnet.1    8.6 (Berkeley) 6/1/94
29 .\" $FreeBSD: src/crypto/telnet/telnet/telnet.1,v 1.4.2.9 2002/04/13 10:59:08 markm Exp $
30 .\"
31 .Dd November 11, 2019
32 .Dt TELNET 1
33 .Os
34 .Sh NAME
35 .Nm telnet
36 .Nd user interface to the
37 .Tn TELNET
38 protocol
39 .Sh SYNOPSIS
40 .Nm
41 .Op Fl 468EFKLNacdfruxy
42 .Op Fl S Ar tos
43 .Op Fl X Ar authtype
44 .Op Fl e Ar escapechar
45 .Op Fl k Ar realm
46 .Op Fl l Ar user
47 .Op Fl n Ar tracefile
48 .Op Fl s Ar src_addr
49 .Oo
50 .Ar host
51 .Op Ar port
52 .Oc
53 .Sh DESCRIPTION
54 The
55 .Nm
56 command
57 is used to communicate with another host using the
58 .Tn TELNET
59 protocol.
60 If
61 .Nm
62 is invoked without the
63 .Ar host
64 argument, it enters command mode,
65 indicated by its prompt
66 .Pq Dq Li telnet\&> .
67 In this mode, it accepts and executes the commands listed below.
68 If it is invoked with arguments, it performs an
69 .Ic open
70 command with those arguments.
71 .Pp
72 Options:
73 .Bl -tag -width indent
74 .It Fl 4
75 Forces
76 .Nm
77 to use IPv4 addresses only.
78 .It Fl 6
79 Forces
80 .Nm
81 to use IPv6 addresses only.
82 .It Fl 8
83 Specifies an 8-bit data path.
84 This causes an attempt to negotiate the
85 .Dv TELNET BINARY
86 option on both input and output.
87 .It Fl E
88 Stops any character from being recognized as an escape character.
89 .It Fl F
90 If Kerberos V5 authentication is being used, the
91 .Fl F
92 option allows the local credentials to be forwarded
93 to the remote system, including any credentials that
94 have already been forwarded into the local environment.
95 .It Fl K
96 Specifies no automatic login to the remote system.
97 This is now the default, so this option is ignored.
98 .It Fl L
99 Specifies an 8-bit data path on output.
100 This causes the
101 .Dv BINARY
102 option to be negotiated on output.
103 .It Fl N
104 Prevents IP address to name lookup when destination host is given
105 as an IP address.
106 .It Fl S Ar tos
107 Sets the IP type-of-service (TOS) option for the telnet
108 connection to the value
109 .Ar tos ,
110 which can be a numeric TOS value
111 or, on systems that support it, a symbolic
112 TOS name found in the
113 .Pa /etc/iptos
114 file.
115 .It Fl X Ar atype
116 Disables the
117 .Ar atype
118 type of authentication.
119 .It Fl a
120 Attempt automatic login.
121 Currently, this sends the user name via the
122 .Ev USER
123 variable
124 of the
125 .Ev ENVIRON
126 option if supported by the remote system.
127 The name used is that of the current user as returned by
128 .Xr getlogin 2
129 if it agrees with the current user ID,
130 otherwise it is the name associated with the user ID.
131 .It Fl c
132 Disables the reading of the user's
133 .Pa \&.telnetrc
134 file.
135 (See the
136 .Ic toggle skiprc
137 command on this man page.)
138 .It Fl d
139 Sets the initial value of the
140 .Ic debug
141 toggle to
142 .Dv TRUE .
143 .It Fl e Ar escapechar
144 Sets the initial
145 .Nm
146 escape character to
147 .Ar escapechar .
148 If
149 .Ar escapechar
150 is omitted, then
151 there will be no escape character.
152 .It Fl f
153 If Kerberos V5 authentication is being used, the
154 .Fl f
155 option allows the local credentials to be forwarded to the remote system.
156 .It Fl k Ar realm
157 If Kerberos authentication is being used, the
158 .Fl k
159 option requests that
160 .Nm
161 obtain tickets for the remote host in
162 realm
163 .Ar realm
164 instead of the remote host's realm, as determined by
165 .Xr krb_realmofhost 3 .
166 .It Fl l Ar user
167 When connecting to the remote system, if the remote system
168 understands the
169 .Ev ENVIRON
170 option, then
171 .Ar user
172 will be sent to the remote system as the value for the variable
173 .Ev USER .
174 This option implies the
175 .Fl a
176 option.
177 This option may also be used with the
178 .Ic open
179 command.
180 .It Fl n Ar tracefile
181 Opens
182 .Ar tracefile
183 for recording trace information.
184 See the
185 .Ic set tracefile
186 command below.
187 .It Fl r
188 Specifies a user interface similar to
189 .Xr rlogin 1 Pq Pa net/bsdrcmds .
190 In this
191 mode, the escape character is set to the tilde (~) character,
192 unless modified by the
193 .Fl e
194 option.
195 .It Fl s Ar src_addr
196 Set the source IP address for the
197 .Nm
198 connection to
199 .Ar src_addr ,
200 which can be an IP address or a host name.
201 .It Fl u
202 Forces
203 .Nm
204 to use
205 .Dv AF_UNIX
206 addresses only (e.g.,
207 .Ux
208 domain sockets, accessed with a file path).
209 .It Fl x
210 Turns on encryption of the data stream if possible.
211 This is now the default, so this option is ignored.
212 .It Fl y
213 Suppresses encryption of the data stream.
214 .It Ar host
215 Indicates the official name, an alias, or the Internet address
216 of a remote host.
217 If
218 .Ar host
219 starts with a
220 .Ql / ,
221 .Nm
222 establishes a connection to the corresponding named socket.
223 .It Ar port
224 Indicates a port number (address of an application).
225 If a number is
226 not specified, the default
227 .Nm
228 port is used.
229 .El
230 .Pp
231 When in rlogin mode, a line of the form ~.\& disconnects from the
232 remote host; ~ is the
233 .Nm
234 escape character.
235 Similarly, the line ~^Z suspends the
236 .Nm
237 session.
238 The line ~^] escapes to the normal
239 .Nm
240 escape prompt.
241 .Pp
242 Once a connection has been opened,
243 .Nm
244 will attempt to enable the
245 .Dv TELNET LINEMODE
246 option.
247 If this fails, then
248 .Nm
249 will revert to one of two input modes:
250 either \*(Lqcharacter at a time\*(Rq
251 or \*(Lqold line by line\*(Rq
252 depending on what the remote system supports.
253 .Pp
254 When
255 .Dv LINEMODE
256 is enabled, character processing is done on the
257 local system, under the control of the remote system.
258 When input
259 editing or character echoing is to be disabled, the remote system
260 will relay that information.
261 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 .Bl -tag -width "mode type"
343 .It Ic auth Ar argument ...
344 The auth command manipulates the information sent through the
345 .Dv TELNET AUTHENTICATE
346 option.
347 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.
353 To 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.
358 To 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.
388 If you omit the input and output, both input and output are disabled.
389 To obtain a list of available types, use the
390 .Ic encrypt disable ?\&
391 command.
392 .It Ic enable Ar type Xo
393 .Op Cm input | output
394 .Xc
395 Enables the specified type of encryption.
396 If you omit input and output, both input and output are enabled.
397 To obtain a list of available types, use the
398 .Ic encrypt enable ?\&
399 command.
400 .It Ic input
401 This is the same as the
402 .Ic encrypt start input
403 command.
404 .It Ic -input
405 This is the same as the
406 .Ic encrypt stop input
407 command.
408 .It Ic output
409 This is the same as the
410 .Ic encrypt start output
411 command.
412 .It Ic -output
413 This is the same as the
414 .Ic encrypt stop output
415 command.
416 .It Ic start Op Cm input | output
417 Attempts to start encryption.
418 If you omit
419 .Ic input
420 and
421 .Ic output ,
422 both input and output are enabled.
423 To 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.
430 If you omit input and output,
431 encryption is on both input and output.
432 .It Ic type Ar type
433 Sets the default type of encryption to be used
434 with later
435 .Ic encrypt start
436 or
437 .Ic encrypt stop
438 commands.
439 .El
440 .It Ic environ Ar arguments ...
441 The
442 .Ic environ
443 command is used to manipulate the
444 variables that may be sent through the
445 .Dv TELNET ENVIRON
446 option.
447 The initial set of variables is taken from the users
448 environment, with only the
449 .Ev DISPLAY
450 and
451 .Ev PRINTER
452 variables being exported by default.
453 The
454 .Ev USER
455 variable is also exported if the
456 .Fl a
457 or
458 .Fl l
459 options are used.
460 .Pp
461 Valid arguments for the
462 .Ic environ
463 command are:
464 .Bl -tag -width Fl
465 .It Ic define Ar variable value
466 Define the variable
467 .Ar variable
468 to have a value of
469 .Ar value .
470 Any variables defined by this command are automatically exported.
471 The
472 .Ar value
473 may be enclosed in single or double quotes so
474 that tabs and spaces may be included.
475 .It Ic undefine Ar variable
476 Remove
477 .Ar variable
478 from the list of environment variables.
479 .It Ic export Ar variable
480 Mark the variable
481 .Ar variable
482 to be exported to the remote side.
483 .It Ic unexport Ar variable
484 Mark the variable
485 .Ar variable
486 to not be exported unless
487 explicitly asked for by the remote side.
488 .It Ic list
489 List the current set of environment variables.
490 Those marked with a
491 .Cm *
492 will be sent automatically,
493 other variables will only be sent if explicitly requested.
494 .It Ic ?\&
495 Prints out help information for the
496 .Ic environ
497 command.
498 .El
499 .It Ic logout
500 Sends the
501 .Dv TELNET LOGOUT
502 option to the remote side.
503 This command is similar to a
504 .Ic close
505 command; however, if the remote side does not support the
506 .Dv LOGOUT
507 option, nothing happens.
508 If, however, the remote side does support the
509 .Dv LOGOUT
510 option, this command should cause the remote side to close the
511 .Tn TELNET
512 connection.
513 If the remote side also supports the concept of
514 suspending a user's session for later reattachment,
515 the logout argument indicates that you
516 should terminate the session immediately.
517 .It Ic mode Ar type
518 .Ar Type
519 is one of several options, depending on the state of the
520 .Tn TELNET
521 session.
522 The remote host is asked for permission to go into the requested mode.
523 If the remote host is capable of entering that mode, the requested
524 mode will be entered.
525 .Bl -tag -width Ar
526 .It Ic character
527 Disable the
528 .Dv TELNET LINEMODE
529 option, or, if the remote side does not understand the
530 .Dv LINEMODE
531 option, then enter \*(Lqcharacter at a time\*(Rq mode.
532 .It Ic line
533 Enable the
534 .Dv TELNET LINEMODE
535 option, or, if the remote side does not understand the
536 .Dv LINEMODE
537 option, then attempt to enter \*(Lqold-line-by-line\*(Rq mode.
538 .It Ic isig Pq Ic \-isig
539 Attempt to enable (disable) the
540 .Dv TRAPSIG
541 mode of the
542 .Dv LINEMODE
543 option.
544 This requires that the
545 .Dv LINEMODE
546 option be enabled.
547 .It Ic edit Pq Ic \-edit
548 Attempt to enable (disable) the
549 .Dv EDIT
550 mode of the
551 .Dv LINEMODE
552 option.
553 This requires that the
554 .Dv LINEMODE
555 option be enabled.
556 .It Ic softtabs Pq Ic \-softtabs
557 Attempt to enable (disable) the
558 .Dv SOFT_TAB
559 mode of the
560 .Dv LINEMODE
561 option.
562 This requires that the
563 .Dv LINEMODE
564 option be enabled.
565 .It Ic litecho Pq Ic \-litecho
566 Attempt to enable (disable) the
567 .Dv LIT_ECHO
568 mode of the
569 .Dv LINEMODE
570 option.
571 This requires that the
572 .Dv LINEMODE
573 option be enabled.
574 .It Ic ?\&
575 Prints out help information for the
576 .Ic mode
577 command.
578 .El
579 .It Xo
580 .Ic open Ar host
581 .Op Fl l Ar user
582 .Op Oo Fl Oc Ns Ar port
583 .Xc
584 Open a connection to the named host.
585 If no port number
586 is specified,
587 .Nm
588 will attempt to contact a
589 .Tn TELNET
590 server at the default port.
591 The host specification may be either a host name (see
592 .Xr hosts 5 ) ,
593 an Internet address specified in the \*(Lqdot notation\*(Rq (see
594 .Xr inet 3 ) ,
595 or IPv6 host name or IPv6 coloned-hexadecimal address.
596 The
597 .Fl l
598 option may be used to specify the user name
599 to be passed to the remote system via the
600 .Ev ENVIRON
601 option.
602 When connecting to a non-standard port,
603 .Nm
604 omits any automatic initiation of
605 .Tn TELNET
606 options.
607 When the port number is preceded by a minus sign,
608 the initial option negotiation is done.
609 After establishing a connection, the file
610 .Pa \&.telnetrc
611 in the
612 users home directory is opened.
613 Lines beginning with a # are comment lines.
614 Blank lines are ignored.
615 Lines that begin without white space are the start of a machine entry.
616 The first thing on the line is the name of the machine that is
617 being connected to.
618 The rest of the line, and successive
619 lines that begin with white space are assumed to be
620 .Nm
621 commands and are processed as if they had been typed
622 in manually to the
623 .Nm
624 command prompt.
625 .It Ic quit
626 Close any open
627 .Tn TELNET
628 session and exit
629 .Nm .
630 An end of file (in command mode) will also close a session and exit.
631 .It Ic send Ar arguments
632 Sends one or more special character sequences to the remote host.
633 The following are the arguments which may be specified
634 (more than one argument may be specified at a time):
635 .Bl -tag -width escape
636 .It Ic abort
637 Sends the
638 .Dv TELNET ABORT
639 (Abort
640 processes)
641 sequence.
642 .It Ic ao
643 Sends the
644 .Dv TELNET AO
645 (Abort Output) sequence, which should cause the remote system to flush
646 all output
647 .Em from
648 the remote system
649 .Em to
650 the user's terminal.
651 .It Ic ayt
652 Sends the
653 .Dv TELNET AYT
654 (Are You There)
655 sequence, to which the remote system may or may not choose to respond.
656 .It Ic brk
657 Sends the
658 .Dv TELNET BRK
659 (Break) sequence, which may have significance to the remote
660 system.
661 .It Ic ec
662 Sends the
663 .Dv TELNET EC
664 (Erase Character)
665 sequence, which should cause the remote system to erase the last character
666 entered.
667 .It Ic el
668 Sends the
669 .Dv TELNET EL
670 (Erase Line)
671 sequence, which should cause the remote system to erase the line currently
672 being entered.
673 .It Ic eof
674 Sends the
675 .Dv TELNET EOF
676 (End Of File)
677 sequence.
678 .It Ic eor
679 Sends the
680 .Dv TELNET EOR
681 (End of Record)
682 sequence.
683 .It Ic escape
684 Sends the current
685 .Nm
686 escape character (initially \*(Lq^\*(Rq).
687 .It Ic ga
688 Sends the
689 .Dv TELNET GA
690 (Go Ahead)
691 sequence, which likely has no significance to the remote system.
692 .It Ic getstatus
693 If the remote side supports the
694 .Dv TELNET STATUS
695 command,
696 .Ic getstatus
697 will send the subnegotiation to request that the server send
698 its current option status.
699 .It Ic ip
700 Sends the
701 .Dv TELNET IP
702 (Interrupt Process) sequence, which should cause the remote
703 system to abort the currently running process.
704 .It Ic nop
705 Sends the
706 .Dv TELNET NOP
707 (No OPeration)
708 sequence.
709 .It Ic susp
710 Sends the
711 .Dv TELNET SUSP
712 (SUSPend process)
713 sequence.
714 .It Ic synch
715 Sends the
716 .Dv TELNET SYNCH
717 sequence.
718 This sequence causes the remote system to discard all previously typed
719 (but not yet read) input.
720 This sequence is sent as
721 .Tn TCP
722 urgent
723 data (and may not work if the remote system is a
724 .Bx 4.2
725 system -- if
726 it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal).
727 .It Ic do Ar cmd
728 .It Ic dont Ar cmd
729 .It Ic will Ar cmd
730 .It Ic wont Ar cmd
731 Sends the
732 .Dv TELNET DO
733 .Ar cmd
734 sequence.
735 .Ar Cmd
736 can be either a decimal number between 0 and 255,
737 or a symbolic name for a specific
738 .Dv TELNET
739 command.
740 .Ar Cmd
741 can also be either
742 .Ic help
743 or
744 .Ic ?\&
745 to print out help information, including
746 a list of known symbolic names.
747 .It Ic ?\&
748 Prints out help information for the
749 .Ic send
750 command.
751 .El
752 .It Ic set Ar argument value
753 .It Ic unset Ar argument value
754 The
755 .Ic set
756 command will set any one of a number of
757 .Nm
758 variables to a specific value or to
759 .Dv TRUE .
760 The special value
761 .Ic off
762 turns off the function associated with
763 the variable, this is equivalent to using the
764 .Ic unset
765 command.
766 The
767 .Ic unset
768 command will disable or set to
769 .Dv FALSE
770 any of the specified functions.
771 The values of variables may be interrogated with the
772 .Ic display
773 command.
774 The variables which may be set or unset, but not toggled, are listed here.
775 In addition, any of the variables for the
776 .Ic toggle
777 command may be explicitly set or unset using
778 the
779 .Ic set
780 and
781 .Ic unset
782 commands.
783 .Bl -tag -width escape
784 .It Ic ayt
785 If
786 .Tn TELNET
787 is in localchars mode, or
788 .Dv LINEMODE
789 is enabled, and the status character is typed, a
790 .Dv TELNET AYT
791 sequence (see
792 .Ic send ayt
793 preceding) is sent to the remote host.
794 The initial value for the \*(LqAre You There\*(Rq
795 character is the terminal's status character.
796 .It Ic echo
797 This is the value (initially \*(Lq^E\*(Rq) which, when in
798 \*(Lqline by line\*(Rq mode, toggles between doing local echoing
799 of entered characters (for normal processing), and suppressing
800 echoing of entered characters (for entering, say, a password).
801 .It Ic eof
802 If
803 .Nm
804 is operating in
805 .Dv LINEMODE
806 or \*(Lqold line by line\*(Rq mode, entering this character
807 as the first character on a line will cause this character to be
808 sent to the remote system.
809 The initial value of the eof character is taken to be the terminal's
810 .Ic eof
811 character.
812 .It Ic erase
813 If
814 .Nm
815 is in
816 .Ic localchars
817 mode (see
818 .Ic toggle
819 .Ic localchars
820 below),
821 .Sy and
822 if
823 .Nm
824 is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
825 character is typed, a
826 .Dv TELNET EC
827 sequence (see
828 .Ic send
829 .Ic ec
830 above)
831 is sent to the remote system.
832 The initial value for the erase character is taken to be
833 the terminal's
834 .Ic erase
835 character.
836 .It Ic escape
837 This is the
838 .Nm
839 escape character (initially \*(Lq^[\*(Rq) which causes entry
840 into
841 .Nm
842 command mode (when connected to a remote system).
843 .It Ic flushoutput
844 If
845 .Nm
846 is in
847 .Ic localchars
848 mode (see
849 .Ic toggle
850 .Ic localchars
851 below)
852 and the
853 .Ic flushoutput
854 character is typed, a
855 .Dv TELNET AO
856 sequence (see
857 .Ic send
858 .Ic ao
859 above)
860 is sent to the remote host.
861 The initial value for the flush character is taken to be
862 the terminal's
863 .Ic flush
864 character.
865 .It Ic forw1
866 .It Ic forw2
867 If
868 .Nm
869 is operating in
870 .Dv LINEMODE ,
871 these are the
872 characters that, when typed, cause partial lines to be
873 forwarded to the remote system.
874 The initial value for
875 the forwarding characters are taken from the terminal's
876 eol and eol2 characters.
877 .It Ic interrupt
878 If
879 .Nm
880 is in
881 .Ic localchars
882 mode (see
883 .Ic toggle
884 .Ic localchars
885 below)
886 and the
887 .Ic interrupt
888 character is typed, a
889 .Dv TELNET IP
890 sequence (see
891 .Ic send
892 .Ic ip
893 above)
894 is sent to the remote host.
895 The initial value for the interrupt character is taken to be
896 the terminal's
897 .Ic intr
898 character.
899 .It Ic kill
900 If
901 .Nm
902 is in
903 .Ic localchars
904 mode (see
905 .Ic toggle
906 .Ic localchars
907 below),
908 .Ic and
909 if
910 .Nm
911 is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
912 character is typed, a
913 .Dv TELNET EL
914 sequence (see
915 .Ic send
916 .Ic el
917 above)
918 is sent to the remote system.
919 The initial value for the kill character is taken to be
920 the terminal's
921 .Ic kill
922 character.
923 .It Ic lnext
924 If
925 .Nm
926 is operating in
927 .Dv LINEMODE
928 or \*(Lqold line by line\*(Rq mode, then this character is taken to
929 be the terminal's
930 .Ic lnext
931 character.
932 The initial value for the lnext character is taken to be
933 the terminal's
934 .Ic lnext
935 character.
936 .It Ic quit
937 If
938 .Nm
939 is in
940 .Ic localchars
941 mode (see
942 .Ic toggle
943 .Ic localchars
944 below)
945 and the
946 .Ic quit
947 character is typed, a
948 .Dv TELNET BRK
949 sequence (see
950 .Ic send
951 .Ic brk
952 above)
953 is sent to the remote host.
954 The initial value for the quit character is taken to be
955 the terminal's
956 .Ic quit
957 character.
958 .It Ic reprint
959 If
960 .Nm
961 is operating in
962 .Dv LINEMODE
963 or \*(Lqold line by line\*(Rq mode, then this character is taken to
964 be the terminal's
965 .Ic reprint
966 character.
967 The initial value for the reprint character is taken to be
968 the terminal's
969 .Ic reprint
970 character.
971 .It Ic rlogin
972 This is the rlogin escape character.
973 If set, the normal
974 .Nm
975 escape character is ignored unless it is
976 preceded by this character at the beginning of a line.
977 This character, at the beginning of a line followed by
978 a "." closes the connection; when followed by a ^Z it
979 suspends the
980 .Nm
981 command.
982 The initial state is to disable the
983 .Nm rlogin
984 escape character.
985 .It Ic start
986 If the
987 .Dv TELNET TOGGLE-FLOW-CONTROL
988 option has been enabled,
989 then this character is taken to
990 be the terminal's
991 .Ic start
992 character.
993 The initial value for the start character is taken to be
994 the terminal's
995 .Ic start
996 character.
997 .It Ic stop
998 If the
999 .Dv TELNET TOGGLE-FLOW-CONTROL
1000 option has been enabled,
1001 then this character is taken to
1002 be the terminal's
1003 .Ic stop
1004 character.
1005 The initial value for the stop character is taken to be
1006 the terminal's
1007 .Ic stop
1008 character.
1009 .It Ic susp
1010 If
1011 .Nm
1012 is in
1013 .Ic localchars
1014 mode, or
1015 .Dv LINEMODE
1016 is enabled, and the
1017 .Ic suspend
1018 character is typed, a
1019 .Dv TELNET SUSP
1020 sequence (see
1021 .Ic send
1022 .Ic susp
1023 above)
1024 is sent to the remote host.
1025 The initial value for the suspend character is taken to be
1026 the terminal's
1027 .Ic suspend
1028 character.
1029 .It Ic tracefile
1030 This is the file to which the output, caused by
1031 .Ic netdata
1032 or
1033 .Ic option
1034 tracing being
1035 .Dv TRUE ,
1036 will be written.
1037 If it is set to
1038 .Dq Fl ,
1039 then tracing information will be written to standard output (the default).
1040 .It Ic worderase
1041 If
1042 .Nm
1043 is operating in
1044 .Dv LINEMODE
1045 or \*(Lqold line by line\*(Rq mode, then this character is taken to
1046 be the terminal's
1047 .Ic worderase
1048 character.
1049 The initial value for the worderase character is taken to be
1050 the terminal's
1051 .Ic worderase
1052 character.
1053 .It Ic ?\&
1054 Displays the legal
1055 .Ic set
1056 .Pq Ic unset
1057 commands.
1058 .El
1059 .It Ic slc Ar state
1060 The
1061 .Ic slc
1062 command (Set Local Characters) is used to set
1063 or change the state of the special
1064 characters when the
1065 .Dv TELNET LINEMODE
1066 option has been enabled.
1067 Special characters are characters that get mapped to
1068 .Tn TELNET
1069 commands sequences (like
1070 .Ic ip
1071 or
1072 .Ic quit )
1073 or line editing characters (like
1074 .Ic erase
1075 and
1076 .Ic kill ) .
1077 By default, the local special characters are exported.
1078 .Bl -tag -width Fl
1079 .It Ic check
1080 Verify the current settings for the current special characters.
1081 The remote side is requested to send all the current special
1082 character settings, and if there are any discrepancies with
1083 the local side, the local side will switch to the remote value.
1084 .It Ic export
1085 Switch to the local defaults for the special characters.
1086 The local default characters are those of the local terminal at 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.
1167 The autoencrypt (autodecrypt) command states that encryption of the
1168 output (input) stream should be enabled as soon as possible.
1169 .It Ic autologin
1170 If the remote side supports the
1171 .Dv TELNET AUTHENTICATION
1172 option
1173 .Nm
1174 attempts to use it to perform automatic authentication.
1175 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.
1343 The initial 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 disabled.
1356 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 system.
1370 If
1371 .Ar command
1372 is omitted, then an interactive
1373 subshell is invoked.
1374 .It Ic ?\& Op Ar command
1375 Get help.
1376 With no arguments,
1377 .Nm
1378 prints a help summary.
1379 If
1380 .Ar command
1381 is specified,
1382 .Nm
1383 will print the help information for just that command.
1384 .El
1385 .Sh ENVIRONMENT
1386 The
1387 .Nm
1388 utility uses at least the
1389 .Ev HOME ,
1390 .Ev SHELL ,
1391 .Ev DISPLAY ,
1392 and
1393 .Ev TERM
1394 environment variables.
1395 Other environment variables may be propagated
1396 to the other side via the
1397 .Dv TELNET ENVIRON
1398 option.
1399 .Sh FILES
1400 .Bl -tag -width ~/.telnetrc -compact
1401 .It Pa ~/.telnetrc
1402 user customized telnet startup values
1403 .El
1404 .Sh SEE ALSO
1405 .Xr rlogin 1 Pq Pa net/bsdrcmds ,
1406 .Xr rsh 1 Pq Pa net/bsdrcmds ,
1407 .Xr hosts 5 ,
1408 .Xr nologin 5 ,
1409 .Xr telnetd 8
1410 .Sh HISTORY
1411 The
1412 .Nm
1413 command appeared in
1414 .Bx 4.2 .
1415 .Pp
1416 IPv6 support was added by WIDE/KAME project.
1417 .Sh NOTES
1418 On some remote systems, echo has to be turned off manually when in
1419 \*(Lqold line by line\*(Rq mode.
1420 .Pp
1421 In \*(Lqold line by line\*(Rq mode or
1422 .Dv LINEMODE
1423 the terminal's
1424 .Ic eof
1425 character is only recognized (and sent to the remote system)
1426 when it is the first character on a line.