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