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