Debian Codegraph @

upstream/fedora-44/man1/telnet.1

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