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