xref: /netbsd-src/usr.bin/telnet/telnet.1 (revision 5dd36a3bc8bf2a9dec29ceb6349550414570c447)
1.\"	$NetBSD: telnet.1,v 1.36 2018/12/15 22:17:02 wiz 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 December 16, 2018
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
353Note:  Because of export controls, the
354.Dv TELNET ENCRYPT
355option is not supported outside of the United States and Canada.
356.Pp
357Valid arguments for the encrypt command are:
358.Bl -tag -width Ar
359.It Ic disable Ar type Ic [input|output]
360Disables the specified type of encryption.
361If you omit the input and output, both input and output
362are disabled.
363To obtain a list of available types, use the
364.Ic encrypt disable \&?
365command.
366.It Ic enable Ar type Ic [input|output]
367Enables the specified type of encryption.
368If you omit input and output, both input and output are
369enabled.
370To obtain a list of available types, use the
371.Ic encrypt enable \&?
372command.
373.It Ic input
374This is the same as the
375.Ic encrypt start input
376command.
377.It Ic -input
378This is the same as the
379.Ic encrypt stop input
380command.
381.It Ic output
382This is the same as the
383.Ic encrypt start output
384command.
385.It Ic -output
386This is the same as the
387.Ic encrypt stop output
388command.
389.It Ic start Ic [input|output]
390Attempts to start encryption.
391If you omit
392.Ic input
393and
394.Ic output ,
395both input and output are enabled.
396To obtain a list of available types, use the
397.Ic encrypt enable \&?
398command.
399.It Ic status
400Lists the current status of encryption.
401.It Ic stop Ic [input|output]
402Stops encryption.
403If you omit input and output,
404encryption is on both input and output.
405.It Ic type Ar type
406Sets the default type of encryption to be used
407with later
408.Ic encrypt start
409or
410.Ic encrypt stop
411commands.
412.El
413.It Ic environ Ar arguments ...
414The
415.Ic environ
416command is used to manipulate the
417variables that may be sent through the
418.Dv TELNET ENVIRON
419option.
420The initial set of variables is taken from the users
421environment, with only the
422.Ev DISPLAY
423and
424.Ev PRINTER
425variables being exported by default.
426The
427.Ev USER
428variable is also exported if the
429.Fl a
430or
431.Fl l
432options are used.
433.Pp
434Valid arguments for the
435.Ic environ
436command are:
437.Bl -tag -width Fl
438.It Ic define Ar variable value
439Define the variable
440.Ar variable
441to have a value of
442.Ar value .
443Any variables defined by this command are automatically exported.
444The
445.Ar value
446may be enclosed in single or double quotes so
447that tabs and spaces may be included.
448.It Ic undefine Ar variable
449Remove
450.Ar variable
451from the list of environment variables.
452.It Ic export Ar variable
453Mark the variable
454.Ar variable
455to be exported to the remote side.
456.It Ic unexport Ar variable
457Mark the variable
458.Ar variable
459to not be exported unless
460explicitly asked for by the remote side.
461.It Ic list
462List the current set of environment variables.
463Those marked with a
464.Cm *
465will be sent automatically,
466other variables will only be sent if explicitly requested.
467.It Ic \&?
468Prints out help information for the
469.Ic environ
470command.
471.El
472.It Ic logout
473Sends the
474.Dv TELNET LOGOUT
475option to the remote side.
476This command is similar to a
477.Ic close
478command; however, if the remote side does not support the
479.Dv LOGOUT
480option, nothing happens.
481If, however, the remote side does support the
482.Dv LOGOUT
483option, this command should cause the remote side to close the
484.Tn TELNET
485connection.
486If the remote side also supports the concept of
487suspending a user's session for later reattachment,
488the logout argument indicates that you
489should terminate the session immediately.
490.It Ic mode Ar type
491.Ar Type
492is one of several options, depending on the state of the
493.Tn TELNET
494session.
495The remote host is asked for permission to go into the requested mode.
496If the remote host is capable of entering that mode, the requested
497mode will be entered.
498.Bl -tag -width Ar
499.It Ic character
500Disable the
501.Dv TELNET LINEMODE
502option, or, if the remote side does not understand the
503.Dv LINEMODE
504option, then enter \*(Lqcharacter at a time\*(Lq mode.
505.It Ic line
506Enable the
507.Dv TELNET LINEMODE
508option, or, if the remote side does not understand the
509.Dv LINEMODE
510option, then attempt to enter \*(Lqold-line-by-line\*(Lq mode.
511.It Ic isig Pq Ic \-isig
512Attempt to enable (disable) the
513.Dv TRAPSIG
514mode of the
515.Dv LINEMODE
516option.
517This requires that the
518.Dv LINEMODE
519option be enabled.
520.It Ic edit Pq Ic \-edit
521Attempt to enable (disable) the
522.Dv EDIT
523mode of the
524.Dv LINEMODE
525option.
526This requires that the
527.Dv LINEMODE
528option be enabled.
529.It Ic softtabs Pq Ic \-softtabs
530Attempt to enable (disable) the
531.Dv SOFT_TAB
532mode of the
533.Dv LINEMODE
534option.
535This requires that the
536.Dv LINEMODE
537option be enabled.
538.It Ic litecho Pq Ic \-litecho
539Attempt to enable (disable) the
540.Dv LIT_ECHO
541mode of the
542.Dv LINEMODE
543option.
544This requires that the
545.Dv LINEMODE
546option be enabled.
547.It Ic \&?
548Prints out help information for the
549.Ic mode
550command.
551.El
552.It Ic open Ar host Oo Fl l Ar user Oc Oo Fl a Oc Oo Oo \&- Oc Ns Ar port Oc
553Open a connection to the named host.
554If no port number
555is specified,
556.Nm
557will attempt to contact a
558.Tn TELNET
559server at the default port.
560The host specification may be either a host name (see
561.Xr hosts 5 )
562or an Internet address specified in the \*(Lqdot notation\*(Rq (see
563.Xr inet 3 ) .
564The
565.Fl l
566option may be used to specify the user name
567to be passed to the remote system via the
568.Ev ENVIRON
569option.
570If a port is specified
571.Nm
572omits any automatic initialisation of
573.Tn TELNET
574options.
575When the port number is preceded by a minus sign,
576the initial option negotiation is done.
577.Pp
578After establishing a connection, the file
579.Pa \&.telnetrc
580in the
581user's home directory is read.
582Lines beginning with a # are
583comment lines.
584Blank lines are ignored.
585Lines that begin
586without white space are the start of a machine entry.
587The first thing on such a line is a string identifying the machine
588that is being connected to.
589It may be the hostname or numeric address specified as the argument
590.Ar host ,
591the canonical name of that string as determined by
592.Xr getaddrinfo 3 ,
593or the string
594.Dq DEFAULT
595indicating all hosts.
596The rest of the line, and successive
597lines that begin with white space are assumed to be
598.Nm
599commands and are processed as if they had been typed
600in manually to the
601.Nm
602command prompt.
603.It Ic quit
604Close any open
605.Tn TELNET
606session and exit
607.Nm .
608An end of file (in command mode) will also close a session and exit.
609.It Ic send Ar arguments
610Sends one or more special character sequences to the remote host.
611The following are the arguments which may be specified
612(more than one argument may be specified at a time):
613.Bl -tag -width escape
614.It Ic abort
615Sends the
616.Dv TELNET ABORT
617(Abort
618processes)
619sequence.
620.It Ic ao
621Sends the
622.Dv TELNET AO
623(Abort Output) sequence, which should cause the remote system to flush
624all output
625.Em from
626the remote system
627.Em to
628the user's terminal.
629.It Ic ayt
630Sends the
631.Dv TELNET AYT
632(Are You There)
633sequence, to which the remote system may or may not choose to respond.
634.It Ic brk
635Sends the
636.Dv TELNET BRK
637(Break) sequence, which may have significance to the remote
638system.
639.It Ic ec
640Sends the
641.Dv TELNET EC
642(Erase Character)
643sequence, which should cause the remote system to erase the last character
644entered.
645.It Ic el
646Sends the
647.Dv TELNET EL
648(Erase Line)
649sequence, which should cause the remote system to erase the line currently
650being entered.
651.It Ic eof
652Sends the
653.Dv TELNET EOF
654(End Of File)
655sequence.
656.It Ic eor
657Sends the
658.Dv TELNET EOR
659(End of Record)
660sequence.
661.It Ic escape
662Sends the current
663.Nm
664escape character (initially \*(Lq^\*(Rq).
665.It Ic ga
666Sends the
667.Dv TELNET GA
668(Go Ahead)
669sequence, which likely has no significance to the remote system.
670.It Ic getstatus
671If the remote side supports the
672.Dv TELNET STATUS
673command,
674.Ic getstatus
675will send the subnegotiation to request that the server send
676its current option status.
677.It Ic ip
678Sends the
679.Dv TELNET IP
680(Interrupt Process) sequence, which should cause the remote
681system to abort the currently running process.
682.It Ic nop
683Sends the
684.Dv TELNET NOP
685(No OPeration)
686sequence.
687.It Ic susp
688Sends the
689.Dv TELNET SUSP
690(SUSPend process)
691sequence.
692.It Ic synch
693Sends the
694.Dv TELNET SYNCH
695sequence.
696This sequence causes the remote system to discard all previously typed
697(but not yet read) input.
698This sequence is sent as
699.Tn TCP
700urgent
701data (and may not work if the remote system is a
702.Bx 4.2
703system \(em if
704it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal).
705.It Ic do Ar cmd
706.It Ic dont Ar cmd
707.It Ic will Ar cmd
708.It Ic wont Ar cmd
709Sends the
710.Dv TELNET DO
711.Ar cmd
712sequence.
713.Ar Cmd
714can be either a decimal number between 0 and 255,
715or a symbolic name for a specific
716.Dv TELNET
717command.
718.Ar Cmd
719can also be either
720.Ic help
721or
722.Ic \&?
723to print out help information, including
724a list of known symbolic names.
725.It Ic \&?
726Prints out help information for the
727.Ic send
728command.
729.El
730.It Ic set Ar argument value
731.It Ic unset Ar argument value
732The
733.Ic set
734command will set any one of a number of
735.Nm
736variables to a specific value or to
737.Dv TRUE .
738The special value
739.Ic off
740turns off the function associated with
741the variable, this is equivalent to using the
742.Ic unset
743command.
744The
745.Ic unset
746command will disable or set to
747.Dv FALSE
748any of the specified functions.
749The values of variables may be interrogated with the
750.Ic display
751command.
752The variables which may be set or unset, but not toggled, are
753listed here.
754In addition, any of the variables for the
755.Ic toggle
756command may be explicitly set or unset using
757the
758.Ic set
759and
760.Ic unset
761commands.
762.Bl -tag -width escape
763.It Ic ayt
764If
765.Tn TELNET
766is in localchars mode, or
767.Dv LINEMODE
768is enabled, and the status character is typed, a
769.Dv TELNET AYT
770sequence (see
771.Ic send ayt
772above) is sent to the
773remote host.
774The initial value for the "Are You There"
775character is the terminal's status character.
776.It Ic echo
777This is the value (initially \*(Lq^E\*(Rq) which, when in
778\*(Lqline by line\*(Rq mode, toggles between doing local echoing
779of entered characters (for normal processing), and suppressing
780echoing of entered characters (for entering, say, a password).
781.It Ic eof
782If
783.Nm
784is operating in
785.Dv LINEMODE
786or \*(Lqold line by line\*(Rq mode, entering this character
787as the first character on a line will cause this character to be
788sent to the remote system.
789The initial value of the eof character is taken to be the terminal's
790.Ic eof
791character.
792.It Ic erase
793If
794.Nm
795is in
796.Ic localchars
797mode (see
798.Ic toggle
799.Ic localchars
800below),
801.Sy and
802if
803.Nm
804is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
805character is typed, a
806.Dv TELNET EC
807sequence (see
808.Ic send
809.Ic ec
810above)
811is sent to the remote system.
812The initial value for the erase character is taken to be
813the terminal's
814.Ic erase
815character.
816.It Ic escape
817This is the
818.Nm
819escape character (initially \*(Lq^[\*(Rq) which causes entry
820into
821.Nm
822command mode (when connected to a remote system).
823.It Ic flushoutput
824If
825.Nm
826is in
827.Ic localchars
828mode (see
829.Ic toggle
830.Ic localchars
831below)
832and the
833.Ic flushoutput
834character is typed, a
835.Dv TELNET AO
836sequence (see
837.Ic send
838.Ic ao
839above)
840is sent to the remote host.
841The initial value for the flush character is taken to be
842the terminal's
843.Ic flush
844character.
845.It Ic forw1
846.It Ic forw2
847If
848.Tn TELNET
849is operating in
850.Dv LINEMODE ,
851these are the
852characters that, when typed, cause partial lines to be
853forwarded to the remote system.
854The initial value for
855the forwarding characters are taken from the terminal's
856eol and eol2 characters.
857.It Ic interrupt
858If
859.Nm
860is in
861.Ic localchars
862mode (see
863.Ic toggle
864.Ic localchars
865below)
866and the
867.Ic interrupt
868character is typed, a
869.Dv TELNET IP
870sequence (see
871.Ic send
872.Ic ip
873above)
874is sent to the remote host.
875The initial value for the interrupt character is taken to be
876the terminal's
877.Ic intr
878character.
879.It Ic kill
880If
881.Nm
882is in
883.Ic localchars
884mode (see
885.Ic toggle
886.Ic localchars
887below),
888.Ic and
889if
890.Nm
891is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
892character is typed, a
893.Dv TELNET EL
894sequence (see
895.Ic send
896.Ic el
897above)
898is sent to the remote system.
899The initial value for the kill character is taken to be
900the terminal's
901.Ic kill
902character.
903.It Ic lnext
904If
905.Nm
906is operating in
907.Dv LINEMODE
908or \*(Lqold line by line\*(Lq mode, then this character is taken to
909be the terminal's
910.Ic lnext
911character.
912The initial value for the lnext character is taken to be
913the terminal's
914.Ic lnext
915character.
916.It Ic quit
917If
918.Nm
919is in
920.Ic localchars
921mode (see
922.Ic toggle
923.Ic localchars
924below)
925and the
926.Ic quit
927character is typed, a
928.Dv TELNET BRK
929sequence (see
930.Ic send
931.Ic brk
932above)
933is sent to the remote host.
934The initial value for the quit character is taken to be
935the terminal's
936.Ic quit
937character.
938.It Ic reprint
939If
940.Nm
941is operating in
942.Dv LINEMODE
943or \*(Lqold line by line\*(Lq mode, then this character is taken to
944be the terminal's
945.Ic reprint
946character.
947The initial value for the reprint character is taken to be
948the terminal's
949.Ic reprint
950character.
951.It Ic rlogin
952This is the rlogin escape character.
953If set, the normal
954.Tn TELNET
955escape character is ignored unless it is
956preceded by this character at the beginning of a line.
957This character, at the beginning of a line followed by
958a "."  closes the connection; when followed by a ^Z it
959suspends the
960.Nm
961command.
962The initial state is to
963disable the rlogin escape character.
964.It Ic start
965If the
966.Dv TELNET TOGGLE-FLOW-CONTROL
967option has been enabled,
968then this character is taken to
969be the terminal's
970.Ic start
971character.
972The initial value for the start character is taken to be
973the terminal's
974.Ic start
975character.
976.It Ic stop
977If the
978.Dv TELNET TOGGLE-FLOW-CONTROL
979option has been enabled,
980then this character is taken to
981be the terminal's
982.Ic stop
983character.
984The initial value for the stop character is taken to be
985the terminal's
986.Ic stop
987character.
988.It Ic susp
989If
990.Nm
991is in
992.Ic localchars
993mode, or
994.Dv LINEMODE
995is enabled, and the
996.Ic suspend
997character is typed, a
998.Dv TELNET SUSP
999sequence (see
1000.Ic send
1001.Ic susp
1002above)
1003is sent to the remote host.
1004The initial value for the suspend character is taken to be
1005the terminal's
1006.Ic suspend
1007character.
1008.It Ic tracefile
1009This is the file to which the output, caused by
1010.Ic netdata
1011or
1012.Ic option
1013tracing being
1014.Dv TRUE ,
1015will be written.
1016If it is set to
1017.Dq Fl ,
1018then tracing information will be written to standard output (the default).
1019.It Ic worderase
1020If
1021.Nm
1022is operating in
1023.Dv LINEMODE
1024or \*(Lqold line by line\*(Lq mode, then this character is taken to
1025be the terminal's
1026.Ic worderase
1027character.
1028The initial value for the worderase character is taken to be
1029the terminal's
1030.Ic worderase
1031character.
1032.It Ic \&?
1033Displays the legal
1034.Ic set
1035.Pq Ic unset
1036commands.
1037.El
1038.It Ic slc Ar state
1039The
1040.Ic slc
1041command (Set Local Characters) is used to set
1042or change the state of the special
1043characters when the
1044.Dv TELNET LINEMODE
1045option has
1046been enabled.
1047Special characters are characters that get
1048mapped to
1049.Tn TELNET
1050commands sequences (like
1051.Ic ip
1052or
1053.Ic quit  )
1054or line editing characters (like
1055.Ic erase
1056and
1057.Ic kill  ) .
1058By default, the local special characters are exported.
1059.Bl -tag -width Fl
1060.It Ic check
1061Verify the current settings for the current special characters.
1062The remote side is requested to send all the current special
1063character settings, and if there are any discrepancies with
1064the local side, the local side will switch to the remote value.
1065.It Ic export
1066Switch to the local defaults for the special characters.
1067The
1068local default characters are those of the local terminal at
1069the time when
1070.Nm
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 .
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
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
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.
1150The autoencrypt
1151(autodecrypt) command states that encryption of the
1152output (input) stream should be enabled as soon as
1153possible.
1154.Pp
1155Note:  Because of export controls, the
1156.Dv TELNET ENCRYPT
1157option is not supported outside the United States and Canada.
1158.It Ic autologin
1159If the remote side supports the
1160.Dv TELNET AUTHENTICATION
1161option
1162.Tn TELNET
1163attempts to use it to perform automatic authentication.
1164If the
1165.Dv AUTHENTICATION
1166option is not supported, the user's login
1167name are propagated through the
1168.Dv TELNET ENVIRON
1169option.
1170This command is the same as specifying the
1171.Fl a
1172option on the
1173.Ic open
1174command.
1175.It Ic autosynch
1176If
1177.Ic autosynch
1178and
1179.Ic localchars
1180are both
1181.Dv TRUE ,
1182then when either the
1183.Ic intr
1184or
1185.Ic quit
1186characters is typed (see
1187.Ic set
1188above for descriptions of the
1189.Ic intr
1190and
1191.Ic quit
1192characters), the resulting
1193.Tn TELNET
1194sequence sent is followed by the
1195.Dv TELNET SYNCH
1196sequence.
1197This procedure
1198.Ic should
1199cause the remote system to begin throwing away all previously
1200typed input until both of the
1201.Tn TELNET
1202sequences have been read and acted upon.
1203The initial value of this toggle is
1204.Dv FALSE .
1205.It Ic binary
1206Enable or disable the
1207.Dv TELNET BINARY
1208option on both input and output.
1209.It Ic inbinary
1210Enable or disable the
1211.Dv TELNET BINARY
1212option on input.
1213.It Ic outbinary
1214Enable or disable the
1215.Dv TELNET BINARY
1216option on output.
1217.It Ic crlf
1218If this is
1219.Dv TRUE ,
1220then carriage returns will be sent as
1221.Li <CR><LF> .
1222If this is
1223.Dv FALSE ,
1224then carriage returns will be send as
1225.Li <CR><NUL> .
1226The initial value for this toggle is
1227.Dv FALSE .
1228.It Ic crmod
1229Toggle carriage return mode.
1230When this mode is enabled, most carriage return characters received from
1231the remote host will be mapped into a carriage return followed by
1232a line feed.
1233This mode does not affect those characters typed by the user, only
1234those received from the remote host.
1235This mode is not very useful unless the remote host
1236only sends carriage return, but never line feed.
1237The initial value for this toggle is
1238.Dv FALSE .
1239.It Ic debug
1240Toggles socket level debugging (useful only to the
1241.Ic super user  ) .
1242The initial value for this toggle is
1243.Dv FALSE .
1244.It Ic encdebug
1245Turns on debugging information for the encryption code.
1246.It Ic localchars
1247If this is
1248.Dv TRUE ,
1249then the
1250.Ic flush  ,
1251.Ic interrupt ,
1252.Ic quit  ,
1253.Ic erase ,
1254and
1255.Ic kill
1256characters (see
1257.Ic set
1258above) are recognized locally, and transformed into (hopefully) appropriate
1259.Tn TELNET
1260control sequences
1261(respectively
1262.Ic ao  ,
1263.Ic ip ,
1264.Ic brk  ,
1265.Ic ec ,
1266and
1267.Ic el  ;
1268see
1269.Ic send
1270above).
1271The initial value for this toggle is
1272.Dv TRUE
1273in \*(Lqold line by line\*(Rq mode,
1274and
1275.Dv FALSE
1276in \*(Lqcharacter at a time\*(Rq mode.
1277When the
1278.Dv LINEMODE
1279option is enabled, the value of
1280.Ic localchars
1281is ignored, and assumed to always be
1282.Dv TRUE .
1283If
1284.Dv LINEMODE
1285has ever been enabled, then
1286.Ic quit
1287is sent as
1288.Ic abort  ,
1289and
1290.Ic eof and
1291.Ic suspend
1292are sent as
1293.Ic eof and
1294.Ic susp
1295(see
1296.Ic send
1297above).
1298.It Ic netdata
1299Toggles the display of all network data (in hexadecimal format).
1300The initial value for this toggle is
1301.Dv FALSE .
1302.It Ic options
1303Toggles the display of some internal
1304.Nm
1305protocol processing (having to do with
1306.Tn TELNET
1307options).
1308The initial value for this toggle is
1309.Dv FALSE .
1310.It Ic prettydump
1311When the
1312.Ic netdata
1313toggle is enabled, if
1314.Ic prettydump
1315is enabled the output from the
1316.Ic netdata
1317command will be formatted in a more user readable format.
1318Spaces are put between each character in the output, and the
1319beginning of any
1320.Tn TELNET
1321escape sequence is preceded by a '*' to aid in locating them.
1322.It Ic skiprc
1323When the skiprc toggle is
1324.Dv TRUE ,
1325.Tn TELNET
1326skips the reading of the
1327.Pa \&.telnetrc
1328file in the users home
1329directory when connections are opened.
1330The 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.
1345The initial value for this toggle is
1346.Dv FALSE .
1347Note:  Because of export controls, data encryption
1348is not supported outside of the United States and Canada.
1349.It Ic \&?
1350Displays the legal
1351.Ic toggle
1352commands.
1353.El
1354.It Ic z
1355Suspend
1356.Nm  .
1357This command only works when the user is using the
1358.Xr csh 1 .
1359.It Ic \&! Op Ar command
1360Execute a single command in a subshell on the local
1361system.
1362If
1363.Ar command
1364is omitted, then an interactive
1365subshell is invoked.
1366.It Ic \&? Op Ar command
1367Get help.
1368With no arguments,
1369.Nm
1370prints a help summary.
1371If a command is specified,
1372.Nm
1373will print the help information for just that command.
1374.El
1375.Sh ENVIRONMENT
1376.Nm
1377uses at least the
1378.Ev HOME ,
1379.Ev SHELL ,
1380.Ev DISPLAY ,
1381and
1382.Ev TERM
1383environment variables.
1384Other environment variables may be propagated
1385to the other side via the
1386.Dv TELNET ENVIRON
1387option.
1388.Sh FILES
1389.Bl -tag -width ~/.telnetrc -compact
1390.It Pa ~/.telnetrc
1391user customized telnet startup values
1392.El
1393.Sh HISTORY
1394The
1395.Nm
1396command appeared in
1397.Bx 4.2 .
1398IPsec support was added by WIDE/KAME project, in 1999.
1399.Sh NOTES
1400On some remote systems, echo has to be turned off manually when in
1401\*(Lqold line by line\*(Rq mode.
1402.Pp
1403In \*(Lqold line by line\*(Rq mode or
1404.Dv LINEMODE
1405the terminal's
1406.Ic eof
1407character is only recognized (and sent to the remote system)
1408when it is the first character on a line.
1409