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