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