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