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