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