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