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