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