xref: /netbsd-src/usr.bin/telnet/telnet.1 (revision 481fca6e59249d8ffcf24fef7cfbe7b131bfb080)
1.\"	$NetBSD: telnet.1,v 1.13 1999/07/28 06:35:16 abs 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 telnet
86command
87is used to communicate with another host using the
88.Tn TELNET
89protocol.
90If
91.Nm telnet
92is invoked without the
93.Ar host
94argument, it enters command mode,
95indicated by its prompt
96.Pq Nm telnet\&> .
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 telnet
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 telnet
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 telnet
236will attempt to enable the
237.Dv TELNET LINEMODE
238option.
239If this fails, then
240.Nm telnet
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 telnet
313command mode may be entered by typing the
314.Nm telnet
315\*(Lqescape character\*(Rq (initially \*(Lq^]\*(Rq).
316When in command mode, the normal terminal editing conventions are available.
317.Pp
318The following
319.Nm telnet
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 telnet
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.
589When connecting to a non-standard port,
590.Nm telnet
591omits any automatic initiation 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 telnet
605commands and are processed as if they had been typed
606in manually to the
607.Nm telnet
608command prompt.
609.It Ic quit
610Close any open
611.Tn TELNET
612session and exit
613.Nm telnet  .
614An end of file (in command mode) will also close a session and exit.
615.It Ic send Ar arguments
616Sends one or more special character sequences to the remote host.
617The following are the arguments which may be specified
618(more than one argument may be specified at a time):
619.Pp
620.Bl -tag -width escape
621.It Ic abort
622Sends the
623.Dv TELNET ABORT
624(Abort
625processes)
626sequence.
627.It Ic ao
628Sends the
629.Dv TELNET AO
630(Abort Output) sequence, which should cause the remote system to flush
631all output
632.Em from
633the remote system
634.Em to
635the user's terminal.
636.It Ic ayt
637Sends the
638.Dv TELNET AYT
639(Are You There)
640sequence, to which the remote system may or may not choose to respond.
641.It Ic brk
642Sends the
643.Dv TELNET BRK
644(Break) sequence, which may have significance to the remote
645system.
646.It Ic ec
647Sends the
648.Dv TELNET EC
649(Erase Character)
650sequence, which should cause the remote system to erase the last character
651entered.
652.It Ic el
653Sends the
654.Dv TELNET EL
655(Erase Line)
656sequence, which should cause the remote system to erase the line currently
657being entered.
658.It Ic eof
659Sends the
660.Dv TELNET EOF
661(End Of File)
662sequence.
663.It Ic eor
664Sends the
665.Dv TELNET EOR
666(End of Record)
667sequence.
668.It Ic escape
669Sends the current
670.Nm telnet
671escape character (initially \*(Lq^\*(Rq).
672.It Ic ga
673Sends the
674.Dv TELNET GA
675(Go Ahead)
676sequence, which likely has no significance to the remote system.
677.It Ic getstatus
678If the remote side supports the
679.Dv TELNET STATUS
680command,
681.Ic getstatus
682will send the subnegotiation to request that the server send
683its current option status.
684.It Ic ip
685Sends the
686.Dv TELNET IP
687(Interrupt Process) sequence, which should cause the remote
688system to abort the currently running process.
689.It Ic nop
690Sends the
691.Dv TELNET NOP
692(No OPeration)
693sequence.
694.It Ic susp
695Sends the
696.Dv TELNET SUSP
697(SUSPend process)
698sequence.
699.It Ic synch
700Sends the
701.Dv TELNET SYNCH
702sequence.
703This sequence causes the remote system to discard all previously typed
704(but not yet read) input.
705This sequence is sent as
706.Tn TCP
707urgent
708data (and may not work if the remote system is a
709.Bx 4.2
710system -- if
711it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal).
712.It Ic do Ar cmd
713.It Ic dont Ar cmd
714.It Ic will Ar cmd
715.It Ic wont Ar cmd
716Sends the
717.Dv TELNET DO
718.Ar cmd
719sequence.
720.Ar Cmd
721can be either a decimal number between 0 and 255,
722or a symbolic name for a specific
723.Dv TELNET
724command.
725.Ar Cmd
726can also be either
727.Ic help
728or
729.Ic \&?
730to print out help information, including
731a list of known symbolic names.
732.It Ic \&?
733Prints out help information for the
734.Ic send
735command.
736.El
737.It Ic set Ar argument value
738.It Ic unset Ar argument value
739The
740.Ic set
741command will set any one of a number of
742.Nm telnet
743variables to a specific value or to
744.Dv TRUE .
745The special value
746.Ic off
747turns off the function associated with
748the variable, this is equivalent to using the
749.Ic unset
750command.
751The
752.Ic unset
753command will disable or set to
754.Dv FALSE
755any of the specified functions.
756The values of variables may be interrogated with the
757.Ic display
758command.
759The variables which may be set or unset, but not toggled, are
760listed here.  In addition, any of the variables for the
761.Ic toggle
762command may be explicitly set or unset using
763the
764.Ic set
765and
766.Ic unset
767commands.
768.Bl -tag -width escape
769.It Ic ayt
770If
771.Tn TELNET
772is in localchars mode, or
773.Dv LINEMODE
774is enabled, and the status character is typed, a
775.Dv TELNET AYT
776sequence (see
777.Ic send ayt
778above) is sent to the
779remote host.  The initial value for the "Are You There"
780character is the terminal's status character.
781.It Ic echo
782This is the value (initially \*(Lq^E\*(Rq) which, when in
783\*(Lqline by line\*(Rq mode, toggles between doing local echoing
784of entered characters (for normal processing), and suppressing
785echoing of entered characters (for entering, say, a password).
786.It Ic eof
787If
788.Nm telnet
789is operating in
790.Dv LINEMODE
791or \*(Lqold line by line\*(Rq mode, entering this character
792as the first character on a line will cause this character to be
793sent to the remote system.
794The initial value of the eof character is taken to be the terminal's
795.Ic eof
796character.
797.It Ic erase
798If
799.Nm telnet
800is in
801.Ic localchars
802mode (see
803.Ic toggle
804.Ic localchars
805below),
806.Sy and
807if
808.Nm telnet
809is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
810character is typed, a
811.Dv TELNET EC
812sequence (see
813.Ic send
814.Ic ec
815above)
816is sent to the remote system.
817The initial value for the erase character is taken to be
818the terminal's
819.Ic erase
820character.
821.It Ic escape
822This is the
823.Nm telnet
824escape character (initially \*(Lq^[\*(Rq) which causes entry
825into
826.Nm telnet
827command mode (when connected to a remote system).
828.It Ic flushoutput
829If
830.Nm telnet
831is in
832.Ic localchars
833mode (see
834.Ic toggle
835.Ic localchars
836below)
837and the
838.Ic flushoutput
839character is typed, a
840.Dv TELNET AO
841sequence (see
842.Ic send
843.Ic ao
844above)
845is sent to the remote host.
846The initial value for the flush character is taken to be
847the terminal's
848.Ic flush
849character.
850.It Ic forw1
851.It Ic forw2
852If
853.Tn TELNET
854is operating in
855.Dv LINEMODE ,
856these are the
857characters that, when typed, cause partial lines to be
858forwarded to the remote system.  The initial value for
859the forwarding characters are taken from the terminal's
860eol and eol2 characters.
861.It Ic interrupt
862If
863.Nm telnet
864is in
865.Ic localchars
866mode (see
867.Ic toggle
868.Ic localchars
869below)
870and the
871.Ic interrupt
872character is typed, a
873.Dv TELNET IP
874sequence (see
875.Ic send
876.Ic ip
877above)
878is sent to the remote host.
879The initial value for the interrupt character is taken to be
880the terminal's
881.Ic intr
882character.
883.It Ic kill
884If
885.Nm telnet
886is in
887.Ic localchars
888mode (see
889.Ic toggle
890.Ic localchars
891below),
892.Ic and
893if
894.Nm telnet
895is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
896character is typed, a
897.Dv TELNET EL
898sequence (see
899.Ic send
900.Ic el
901above)
902is sent to the remote system.
903The initial value for the kill character is taken to be
904the terminal's
905.Ic kill
906character.
907.It Ic lnext
908If
909.Nm telnet
910is operating in
911.Dv LINEMODE
912or \*(Lqold line by line\*(Lq mode, then this character is taken to
913be the terminal's
914.Ic lnext
915character.
916The initial value for the lnext character is taken to be
917the terminal's
918.Ic lnext
919character.
920.It Ic quit
921If
922.Nm telnet
923is in
924.Ic localchars
925mode (see
926.Ic toggle
927.Ic localchars
928below)
929and the
930.Ic quit
931character is typed, a
932.Dv TELNET BRK
933sequence (see
934.Ic send
935.Ic brk
936above)
937is sent to the remote host.
938The initial value for the quit character is taken to be
939the terminal's
940.Ic quit
941character.
942.It Ic reprint
943If
944.Nm telnet
945is operating in
946.Dv LINEMODE
947or \*(Lqold line by line\*(Lq mode, then this character is taken to
948be the terminal's
949.Ic reprint
950character.
951The initial value for the reprint character is taken to be
952the terminal's
953.Ic reprint
954character.
955.It Ic rlogin
956This is the rlogin escape character.
957If set, the normal
958.Tn TELNET
959escape character is ignored unless it is
960preceded by this character at the beginning of a line.
961This character, at the beginning of a line followed by
962a "."  closes the connection; when followed by a ^Z it
963suspends the
964.Nm telnet
965command.  The initial state is to
966disable the rlogin escape character.
967.It Ic start
968If the
969.Dv TELNET TOGGLE-FLOW-CONTROL
970option has been enabled,
971then this character is taken to
972be the terminal's
973.Ic start
974character.
975The initial value for the start character is taken to be
976the terminal's
977.Ic start
978character.
979.It Ic stop
980If the
981.Dv TELNET TOGGLE-FLOW-CONTROL
982option has been enabled,
983then this character is taken to
984be the terminal's
985.Ic stop
986character.
987The initial value for the stop character is taken to be
988the terminal's
989.Ic stop
990character.
991.It Ic susp
992If
993.Nm telnet
994is in
995.Ic localchars
996mode, or
997.Dv LINEMODE
998is enabled, and the
999.Ic suspend
1000character is typed, a
1001.Dv TELNET SUSP
1002sequence (see
1003.Ic send
1004.Ic susp
1005above)
1006is sent to the remote host.
1007The initial value for the suspend character is taken to be
1008the terminal's
1009.Ic suspend
1010character.
1011.It Ic tracefile
1012This is the file to which the output, caused by
1013.Ic netdata
1014or
1015.Ic option
1016tracing being
1017.Dv TRUE ,
1018will be written.  If it is set to
1019.Dq Fl ,
1020then tracing information will be written to standard output (the default).
1021.It Ic worderase
1022If
1023.Nm telnet
1024is operating in
1025.Dv LINEMODE
1026or \*(Lqold line by line\*(Lq mode, then this character is taken to
1027be the terminal's
1028.Ic worderase
1029character.
1030The initial value for the worderase character is taken to be
1031the terminal's
1032.Ic worderase
1033character.
1034.It Ic \&?
1035Displays the legal
1036.Ic set
1037.Pq Ic unset
1038commands.
1039.El
1040.It Ic slc Ar state
1041The
1042.Ic slc
1043command (Set Local Characters) is used to set
1044or change the state of the special
1045characters when the
1046.Dv TELNET LINEMODE
1047option has
1048been enabled.  Special characters are characters that get
1049mapped to
1050.Tn TELNET
1051commands sequences (like
1052.Ic ip
1053or
1054.Ic quit  )
1055or line editing characters (like
1056.Ic erase
1057and
1058.Ic kill  ) .
1059By default, the local special characters are exported.
1060.Bl -tag -width Fl
1061.It Ic check
1062Verify the current settings for the current special characters.
1063The remote side is requested to send all the current special
1064character settings, and if there are any discrepancies with
1065the local side, the local side will switch to the remote value.
1066.It Ic export
1067Switch to the local defaults for the special characters.  The
1068local default characters are those of the local terminal at
1069the time when
1070.Nm telnet
1071was started.
1072.It Ic import
1073Switch to the remote defaults for the special characters.
1074The remote default characters are those of the remote system
1075at the time when the
1076.Tn TELNET
1077connection was established.
1078.It Ic \&?
1079Prints out help information for the
1080.Ic slc
1081command.
1082.El
1083.It Ic status
1084Show the current status of
1085.Nm telnet  .
1086This includes the peer one is connected to, as well
1087as the current mode.
1088.It Ic toggle Ar arguments ...
1089Toggle (between
1090.Dv TRUE
1091and
1092.Dv FALSE )
1093various flags that control how
1094.Nm telnet
1095responds to events.
1096These flags may be set explicitly to
1097.Dv TRUE
1098or
1099.Dv FALSE
1100using the
1101.Ic set
1102and
1103.Ic unset
1104commands listed above.
1105More than one argument may be specified.
1106The state of these flags may be interrogated with the
1107.Ic display
1108command.
1109Valid arguments are:
1110.Bl -tag -width Ar
1111.It Ic authdebug
1112Turns on debugging information for the authentication code.
1113.It Ic autoflush
1114If
1115.Ic autoflush
1116and
1117.Ic localchars
1118are both
1119.Dv TRUE ,
1120then when the
1121.Ic ao  ,
1122or
1123.Ic quit
1124characters are recognized (and transformed into
1125.Tn TELNET
1126sequences; see
1127.Ic set
1128above for details),
1129.Nm telnet
1130refuses to display any data on the user's terminal
1131until the remote system acknowledges (via a
1132.Dv TELNET TIMING MARK
1133option)
1134that it has processed those
1135.Tn TELNET
1136sequences.
1137The initial value for this toggle is
1138.Dv TRUE
1139if the terminal user had not
1140done an "stty noflsh", otherwise
1141.Dv FALSE
1142(see
1143.Xr stty  1  ) .
1144.It Ic autodecrypt
1145When the
1146.Dv TELNET ENCRYPT
1147option is negotiated, by
1148default the actual encryption (decryption) of the data
1149stream does not start automatically.  The autoencrypt
1150(autodecrypt) command states that encryption of the
1151output (input) stream should be enabled as soon as
1152possible.
1153.Pp
1154Note:  Because of export controls, the
1155.Dv TELNET ENCRYPT
1156option is not supported outside the United States and Canada.
1157.It Ic autologin
1158If the remote side supports the
1159.Dv TELNET AUTHENTICATION
1160option
1161.Tn TELNET
1162attempts to use it to perform automatic authentication.  If the
1163.Dv AUTHENTICATION
1164option is not supported, the user's login
1165name are propagated through the
1166.Dv TELNET ENVIRON
1167option.
1168This command is the same as specifying the
1169.Fl a
1170option on the
1171.Ic open
1172command.
1173.It Ic autosynch
1174If
1175.Ic autosynch
1176and
1177.Ic localchars
1178are both
1179.Dv TRUE ,
1180then when either the
1181.Ic intr
1182or
1183.Ic quit
1184characters is typed (see
1185.Ic set
1186above for descriptions of the
1187.Ic intr
1188and
1189.Ic quit
1190characters), the resulting
1191.Tn TELNET
1192sequence sent is followed by the
1193.Dv TELNET SYNCH
1194sequence.
1195This procedure
1196.Ic should
1197cause the remote system to begin throwing away all previously
1198typed input until both of the
1199.Tn TELNET
1200sequences have been read and acted upon.
1201The initial value of this toggle is
1202.Dv FALSE .
1203.It Ic binary
1204Enable or disable the
1205.Dv TELNET BINARY
1206option on both input and output.
1207.It Ic inbinary
1208Enable or disable the
1209.Dv TELNET BINARY
1210option on input.
1211.It Ic outbinary
1212Enable or disable the
1213.Dv TELNET BINARY
1214option on output.
1215.It Ic crlf
1216If this is
1217.Dv TRUE ,
1218then carriage returns will be sent as
1219.Li <CR><LF> .
1220If this is
1221.Dv FALSE ,
1222then carriage returns will be send as
1223.Li <CR><NUL> .
1224The initial value for this toggle is
1225.Dv FALSE .
1226.It Ic crmod
1227Toggle carriage return mode.
1228When this mode is enabled, most carriage return characters received from
1229the remote host will be mapped into a carriage return followed by
1230a line feed.
1231This mode does not affect those characters typed by the user, only
1232those received from the remote host.
1233This mode is not very useful unless the remote host
1234only sends carriage return, but never line feed.
1235The initial value for this toggle is
1236.Dv FALSE .
1237.It Ic debug
1238Toggles socket level debugging (useful only to the
1239.Ic super user  ) .
1240The initial value for this toggle is
1241.Dv FALSE .
1242.It Ic encdebug
1243Turns on debugging information for the encryption code.
1244.It Ic localchars
1245If this is
1246.Dv TRUE ,
1247then the
1248.Ic flush  ,
1249.Ic interrupt ,
1250.Ic quit  ,
1251.Ic erase ,
1252and
1253.Ic kill
1254characters (see
1255.Ic set
1256above) are recognized locally, and transformed into (hopefully) appropriate
1257.Tn TELNET
1258control sequences
1259(respectively
1260.Ic ao  ,
1261.Ic ip ,
1262.Ic brk  ,
1263.Ic ec ,
1264and
1265.Ic el  ;
1266see
1267.Ic send
1268above).
1269The initial value for this toggle is
1270.Dv TRUE
1271in \*(Lqold line by line\*(Rq mode,
1272and
1273.Dv FALSE
1274in \*(Lqcharacter at a time\*(Rq mode.
1275When the
1276.Dv LINEMODE
1277option is enabled, the value of
1278.Ic localchars
1279is ignored, and assumed to always be
1280.Dv TRUE .
1281If
1282.Dv LINEMODE
1283has ever been enabled, then
1284.Ic quit
1285is sent as
1286.Ic abort  ,
1287and
1288.Ic eof and
1289.Ic suspend
1290are sent as
1291.Ic eof and
1292.Ic susp
1293(see
1294.Ic send
1295above).
1296.It Ic netdata
1297Toggles the display of all network data (in hexadecimal format).
1298The initial value for this toggle is
1299.Dv FALSE .
1300.It Ic options
1301Toggles the display of some internal
1302.Nm telnet
1303protocol processing (having to do with
1304.Tn TELNET
1305options).
1306The initial value for this toggle is
1307.Dv FALSE .
1308.It Ic prettydump
1309When the
1310.Ic netdata
1311toggle is enabled, if
1312.Ic prettydump
1313is enabled the output from the
1314.Ic netdata
1315command will be formatted in a more user readable format.
1316Spaces are put between each character in the output, and the
1317beginning of any
1318.Tn TELNET
1319escape sequence is preceded by a '*' to aid in locating them.
1320.It Ic skiprc
1321When the skiprc toggle is
1322.Dv TRUE ,
1323.Tn TELNET
1324skips the reading of the
1325.Pa \&.telnetrc
1326file in the users home
1327directory when connections are opened.  The initial
1328value for this toggle is
1329.Dv FALSE.
1330.It Ic termdata
1331Toggles the display of all terminal data (in hexadecimal format).
1332The initial value for this toggle is
1333.Dv FALSE .
1334.It Ic verbose_encrypt
1335When the
1336.Ic verbose_encrypt
1337toggle is
1338.Dv TRUE ,
1339.Nm telnet
1340prints out a message each time encryption is enabled or
1341disabled.  The initial value for this toggle is
1342.Dv FALSE.
1343Note:  Because of export controls, data encryption
1344is not supported outside of the United States and Canada.
1345.It Ic \&?
1346Displays the legal
1347.Ic toggle
1348commands.
1349.El
1350.It Ic z
1351Suspend
1352.Nm telnet  .
1353This command only works when the user is using the
1354.Xr csh  1  .
1355.It Ic \&! Op Ar command
1356Execute a single command in a subshell on the local
1357system.  If
1358.Ar command
1359is omitted, then an interactive
1360subshell is invoked.
1361.It Ic \&? Op Ar command
1362Get help.  With no arguments,
1363.Nm telnet
1364prints a help summary.
1365If a command is specified,
1366.Nm telnet
1367will print the help information for just that command.
1368.El
1369.Sh ENVIRONMENT
1370.Nm Telnet
1371uses at least the
1372.Ev HOME ,
1373.Ev SHELL ,
1374.Ev DISPLAY ,
1375and
1376.Ev TERM
1377environment variables.
1378Other environment variables may be propagated
1379to the other side via the
1380.Dv TELNET ENVIRON
1381option.
1382.Sh FILES
1383.Bl -tag -width ~/.telnetrc -compact
1384.It Pa ~/.telnetrc
1385user customized telnet startup values
1386.El
1387.Sh HISTORY
1388The
1389.Nm Telnet
1390command appeared in
1391.Bx 4.2 .
1392IPsec support was added by WIDE/KAME project, in 1999.
1393.Sh NOTES
1394.Pp
1395On some remote systems, echo has to be turned off manually when in
1396\*(Lqold line by line\*(Rq mode.
1397.Pp
1398In \*(Lqold line by line\*(Rq mode or
1399.Dv LINEMODE
1400the terminal's
1401.Ic eof
1402character is only recognized (and sent to the remote system)
1403when it is the first character on a line.
1404