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