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