.\" SUCH DAMAGE.
.\"
.\" @(#)telnet.1 8.6 (Berkeley) 6/1/94
+.\" $FreeBSD: src/crypto/telnet/telnet/telnet.1,v 1.4.2.9 2002/04/13 10:59:08 markm Exp $
.\"
-.Dd June 1, 1994
+.Dd January 27, 2000
.Dt TELNET 1
-.Os BSD 4.2
+.Os
.Sh NAME
.Nm telnet
-.Nd user interface to the
+.Nd user interface to the
.Tn TELNET
protocol
.Sh SYNOPSIS
-.Nm telnet
-.Op Fl 8EFKLacdfrx
+.Nm
+.Op Fl 468EFKLNacdfruxy
.Op Fl S Ar tos
.Op Fl X Ar authtype
.Op Fl e Ar escapechar
.Op Fl k Ar realm
.Op Fl l Ar user
.Op Fl n Ar tracefile
+.Op Fl s Ar src_addr
.Oo
.Ar host
-.Op port
+.Op Ar port
.Oc
.Sh DESCRIPTION
The
-.Nm telnet
+.Nm
command
-is used to communicate with another host using the
+is used to communicate with another host using the
.Tn TELNET
protocol.
If
-.Nm telnet
+.Nm
is invoked without the
.Ar host
argument, it enters command mode,
indicated by its prompt
-.Pq Nm telnet\&> .
+.Pq Dq Li telnet\&> .
In this mode, it accepts and executes the commands listed below.
If it is invoked with arguments, it performs an
.Ic open
.Pp
Options:
.Bl -tag -width indent
+.It Fl 4
+Forces
+.Nm
+to use IPv4 addresses only.
+.It Fl 6
+Forces
+.Nm
+to use IPv6 addresses only.
.It Fl 8
Specifies an 8-bit data path. This causes an attempt to
negotiate the
Specifies no automatic login to the remote system.
.It Fl L
Specifies an 8-bit data path on output. This causes the
-BINARY option to be negotiated on output.
+.Dv BINARY
+option to be negotiated on output.
+.It Fl N
+Prevents IP address to name lookup when destination host is given
+as an IP address.
.It Fl S Ar tos
Sets the IP type-of-service (TOS) option for the telnet
connection to the value
-.Ar tos,
+.Ar tos ,
which can be a numeric TOS value
or, on systems that support it, a symbolic
-TOS name found in the /etc/iptos file.
-.It Fl X Ar atype
+TOS name found in the
+.Pa /etc/iptos
+file.
+.It Fl X Ar atype
Disables the
.Ar atype
type of authentication.
.It Fl a
Attempt automatic login.
+This is now the default, so this option is ignored.
Currently, this sends the user name via the
.Ev USER
variable
Sets the initial value of the
.Ic debug
toggle to
-.Dv TRUE
-.It Fl e Ar escape char
+.Dv TRUE .
+.It Fl e Ar escapechar
Sets the initial
.Nm
-.Nm telnet
escape character to
-.Ar escape char.
+.Ar escapechar .
If
-.Ar escape char
+.Ar escapechar
is omitted, then
there will be no escape character.
.It Fl f
If Kerberos V5 authentication is being used, the
.Fl f
option allows the local credentials to be forwarded to the remote system.
-.ne 1i
.It Fl k Ar realm
If Kerberos authentication is being used, the
.Fl k
-option requests that telnet obtain tickets for the remote host in
-realm realm instead of the remote host's realm, as determined
-by
+option requests that
+.Nm
+obtain tickets for the remote host in
+realm
+.Ar realm
+instead of the remote host's realm, as determined by
.Xr krb_realmofhost 3 .
-.It Fl l Ar user
+.It Fl l Ar user
When connecting to the remote system, if the remote system
understands the
.Ev ENVIRON
option, then
.Ar user
-will be sent to the remote system as the value for the variable USER.
+will be sent to the remote system as the value for the variable
+.Ev USER .
This option implies the
.Fl a
option.
This option may also be used with the
.Ic open
command.
-.It Fl n Ar tracefile
+.It Fl n Ar tracefile
Opens
.Ar tracefile
for recording trace information.
.Xr rlogin 1 .
In this
mode, the escape character is set to the tilde (~) character,
-unless modified by the -e option.
+unless modified by the
+.Fl e
+option.
+.It Fl s Ar src_addr
+Set the source IP address for the
+.Nm
+connection to
+.Ar src_addr ,
+which can be an IP address or a host name.
+.It Fl u
+Forces
+.Nm
+to use
+.Dv AF_UNIX
+addresses only (e.g.,
+.Ux
+domain sockets, accessed with a file path).
.It Fl x
-Turns on encryption of the data stream if possible. This
-option is not available outside of the United States and
-Canada.
+Turns on encryption of the data stream if possible.
+This is now the default, so this option is ignored.
+.It Fl y
+Suppresses encryption of the data stream.
.It Ar host
Indicates the official name, an alias, or the Internet address
of a remote host.
+If
+.Ar host
+starts with a
+.Ql / ,
+.Nm
+establishes a connection to the corresponding named socket.
.It Ar port
Indicates a port number (address of an application). If a number is
not specified, the default
-.Nm telnet
+.Nm
port is used.
.El
.Pp
When in rlogin mode, a line of the form ~. disconnects from the
-remote host; ~ is the telnet escape character.
-Similarly, the line ~^Z suspends the telnet session.
-The line ~^] escapes to the normal telnet escape prompt.
+remote host; ~ is the
+.Nm
+escape character.
+Similarly, the line ~^Z suspends the
+.Nm
+session.
+The line ~^] escapes to the normal
+.Nm
+escape prompt.
.Pp
Once a connection has been opened,
-.Nm telnet
+.Nm
will attempt to enable the
.Dv TELNET LINEMODE
option.
If this fails, then
-.Nm telnet
+.Nm
will revert to one of two input modes:
either \*(Lqcharacter at a time\*(Rq
or \*(Lqold line by line\*(Rq
depending on what the remote system supports.
.Pp
-When
+When
.Dv LINEMODE
is enabled, character processing is done on the
local system, under the control of the remote system. When input
(this would mostly be used to enter passwords
without the password being echoed).
.Pp
-If the
+If the
.Dv LINEMODE
option is enabled, or if the
.Ic localchars
toggle is
.Dv TRUE
-(the default for \*(Lqold line by line\*(Lq; see below),
+(the default for \*(Lqold line by line\*(Rq; see below),
the user's
.Ic quit ,
.Ic intr ,
characters are trapped locally, and sent as
.Tn TELNET
protocol sequences to the remote side.
-If
+If
.Dv LINEMODE
has ever been enabled, then the user's
.Ic susp
protocol sequences,
and
.Ic quit
-is sent as a
+is sent as a
.Dv TELNET ABORT
-instead of
-.Dv BREAK
+instead of
+.Dv BREAK .
There are options (see
.Ic toggle
.Ic autoflush
.Ic intr ) .
.Pp
While connected to a remote host,
-.Nm telnet
+.Nm
command mode may be entered by typing the
-.Nm telnet
+.Nm
\*(Lqescape character\*(Rq (initially \*(Lq^]\*(Rq).
When in command mode, the normal terminal editing conventions are available.
.Pp
The following
-.Nm telnet
+.Nm
commands are available.
Only enough of each command to uniquely identify it need be typed
(this is also true for arguments to the
commands).
.Pp
.Bl -tag -width "mode type"
-.It Ic auth Ar argument ...
+.It Ic auth Ar argument ...
The auth command manipulates the information sent through the
.Dv TELNET AUTHENTICATE
option. Valid arguments for the
-auth command are as follows:
+.Ic auth
+command are:
.Bl -tag -width "disable type"
.It Ic disable Ar type
Disables the specified type of authentication. To
obtain a list of available types, use the
-.Ic auth disable \&?
+.Ic auth disable ?\&
command.
.It Ic enable Ar type
Enables the specified type of authentication. To
obtain a list of available types, use the
-.Ic auth enable \&?
+.Ic auth enable ?\&
command.
.It Ic status
Lists the current status of the various types of
Close a
.Tn TELNET
session and return to command mode.
-.It Ic display Ar argument ...
+.It Ic display Ar argument ...
Displays all, or some, of the
.Ic set
and
.Dv TELNET ENCRYPT
option.
.Pp
-Note: Because of export controls, the
-.Dv TELNET ENCRYPT
-option is not supported outside of the United States and Canada.
-.Pp
-Valid arguments for the encrypt command are as follows:
+Valid arguments for the
+.Ic encrypt
+command are:
.Bl -tag -width Ar
-.It Ic disable Ar type Ic [input|output]
+.It Ic disable Ar type Xo
+.Op Cm input | output
+.Xc
Disables the specified type of encryption. If you
omit the input and output, both input and output
are disabled. To obtain a list of available
types, use the
-.Ic encrypt disable \&?
+.Ic encrypt disable ?\&
command.
-.It Ic enable Ar type Ic [input|output]
+.It Ic enable Ar type Xo
+.Op Cm input | output
+.Xc
Enables the specified type of encryption. If you
omit input and output, both input and output are
enabled. To obtain a list of available types, use the
-.Ic encrypt enable \&?
+.Ic encrypt enable ?\&
command.
.It Ic input
This is the same as the
This is the same as the
.Ic encrypt stop output
command.
-.It Ic start Ic [input|output]
+.It Ic start Op Cm input | output
Attempts to start encryption. If you omit
.Ic input
and
-.Ic output,
+.Ic output ,
both input and output are enabled. To
obtain a list of available types, use the
-.Ic encrypt enable \&?
+.Ic encrypt enable ?\&
command.
.It Ic status
Lists the current status of encryption.
-.It Ic stop Ic [input|output]
+.It Ic stop Op Cm input | output
Stops encryption. If you omit input and output,
encryption is on both input and output.
.It Ic type Ar type
.Ic encrypt stop
commands.
.El
-.It Ic environ Ar arguments...
+.It Ic environ Ar arguments ...
The
.Ic environ
command is used to manipulate the
-the variables that my be sent through the
+variables that may be sent through the
.Dv TELNET ENVIRON
option.
The initial set of variables is taken from the users
or
.Fl l
options are used.
-.br
+.Pp
Valid arguments for the
.Ic environ
command are:
.Bl -tag -width Fl
-.It Ic define Ar variable value
+.It Ic define Ar variable value
Define the variable
.Ar variable
to have a value of
-.Ar value.
+.Ar value .
Any variables defined by this command are automatically exported.
The
.Ar value
may be enclosed in single or double quotes so
that tabs and spaces may be included.
-.It Ic undefine Ar variable
+.It Ic undefine Ar variable
Remove
.Ar variable
from the list of environment variables.
-.It Ic export Ar variable
+.It Ic export Ar variable
Mark the variable
.Ar variable
to be exported to the remote side.
-.It Ic unexport Ar variable
+.It Ic unexport Ar variable
Mark the variable
.Ar variable
to not be exported unless
.Cm *
will be sent automatically,
other variables will only be sent if explicitly requested.
-.It Ic \&?
+.It Ic ?\&
Prints out help information for the
.Ic environ
command.
suspending a user's session for later reattachment,
the logout argument indicates that you
should terminate the session immediately.
-.It Ic mode Ar type
+.It Ic mode Ar type
.Ar Type
is one of several options, depending on the state of the
.Tn TELNET
.Dv TELNET LINEMODE
option, or, if the remote side does not understand the
.Dv LINEMODE
-option, then enter \*(Lqcharacter at a time\*(Lq mode.
+option, then enter \*(Lqcharacter at a time\*(Rq mode.
.It Ic line
Enable the
.Dv TELNET LINEMODE
option, or, if the remote side does not understand the
.Dv LINEMODE
-option, then attempt to enter \*(Lqold-line-by-line\*(Lq mode.
-.It Ic isig Pq Ic \-isig
-Attempt to enable (disable) the
+option, then attempt to enter \*(Lqold-line-by-line\*(Rq mode.
+.It Ic isig Pq Ic \-isig
+Attempt to enable (disable) the
.Dv TRAPSIG
-mode of the
+mode of the
.Dv LINEMODE
option.
-This requires that the
+This requires that the
.Dv LINEMODE
option be enabled.
-.It Ic edit Pq Ic \-edit
-Attempt to enable (disable) the
+.It Ic edit Pq Ic \-edit
+Attempt to enable (disable) the
.Dv EDIT
-mode of the
+mode of the
.Dv LINEMODE
option.
-This requires that the
+This requires that the
.Dv LINEMODE
option be enabled.
-.It Ic softtabs Pq Ic \-softtabs
-Attempt to enable (disable) the
+.It Ic softtabs Pq Ic \-softtabs
+Attempt to enable (disable) the
.Dv SOFT_TAB
-mode of the
+mode of the
.Dv LINEMODE
option.
-This requires that the
+This requires that the
.Dv LINEMODE
option be enabled.
-.ne 1i
-.It Ic litecho Pq Ic \-litecho
-Attempt to enable (disable) the
+.It Ic litecho Pq Ic \-litecho
+Attempt to enable (disable) the
.Dv LIT_ECHO
-mode of the
+mode of the
.Dv LINEMODE
option.
-This requires that the
+This requires that the
.Dv LINEMODE
option be enabled.
-.It Ic \&?
+.It Ic ?\&
Prints out help information for the
.Ic mode
command.
.El
.It Xo
.Ic open Ar host
-.Oo Op Fl l
-.Ar user
-.Oc Ns Oo Fl
-.Ar port Oc
+.Op Fl l Ar user
+.Op Oo Fl Oc Ns Ar port
.Xc
Open a connection to the named host.
If no port number
is specified,
-.Nm telnet
+.Nm
will attempt to contact a
.Tn TELNET
server at the default port.
The host specification may be either a host name (see
-.Xr hosts 5 )
-or an Internet address specified in the \*(Lqdot notation\*(Rq (see
-.Xr inet 3 ) .
+.Xr hosts 5 ) ,
+an Internet address specified in the \*(Lqdot notation\*(Rq (see
+.Xr inet 3 ) ,
+or IPv6 host name or IPv6 coloned-hexadecimal addreess.
The
-.Op Fl l
+.Fl l
option may be used to specify the user name
to be passed to the remote system via the
.Ev ENVIRON
option.
When connecting to a non-standard port,
-.Nm telnet
+.Nm
omits any automatic initiation of
.Tn TELNET
options. When the port number is preceded by a minus sign,
first thing on the line is the name of the machine that is
being connected to. The rest of the line, and successive
lines that begin with white space are assumed to be
-.Nm telnet
+.Nm
commands and are processed as if they had been typed
in manually to the
-.Nm telnet
+.Nm
command prompt.
.It Ic quit
Close any open
.Tn TELNET
session and exit
-.Nm telnet .
+.Nm .
An end of file (in command mode) will also close a session and exit.
-.It Ic send Ar arguments
+.It Ic send Ar arguments
Sends one or more special character sequences to the remote host.
The following are the arguments which may be specified
(more than one argument may be specified at a time):
sequence.
.It Ic escape
Sends the current
-.Nm telnet
+.Nm
escape character (initially \*(Lq^\*(Rq).
.It Ic ga
Sends the
.Ic getstatus
will send the subnegotiation to request that the server send
its current option status.
-.ne 1i
.It Ic ip
Sends the
.Dv TELNET IP
can also be either
.Ic help
or
-.Ic \&?
+.Ic ?\&
to print out help information, including
a list of known symbolic names.
-.It Ic \&?
+.It Ic ?\&
Prints out help information for the
.Ic send
command.
.El
-.It Ic set Ar argument value
-.It Ic unset Ar argument value
+.It Ic set Ar argument value
+.It Ic unset Ar argument value
The
.Ic set
command will set any one of a number of
-.Nm telnet
+.Nm
variables to a specific value or to
.Dv TRUE .
The special value
sequence (see
.Ic send ayt
preceding) is sent to the
-remote host. The initial value for the "Are You There"
+remote host. The initial value for the \*(LqAre You There\*(Rq
character is the terminal's status character.
.It Ic echo
This is the value (initially \*(Lq^E\*(Rq) which, when in
echoing of entered characters (for entering, say, a password).
.It Ic eof
If
-.Nm telnet
+.Nm
is operating in
.Dv LINEMODE
or \*(Lqold line by line\*(Rq mode, entering this character
character.
.It Ic erase
If
-.Nm telnet
+.Nm
is in
.Ic localchars
mode (see
below),
.Sy and
if
-.Nm telnet
+.Nm
is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
character is typed, a
.Dv TELNET EC
character.
.It Ic escape
This is the
-.Nm telnet
+.Nm
escape character (initially \*(Lq^[\*(Rq) which causes entry
into
-.Nm telnet
+.Nm
command mode (when connected to a remote system).
.It Ic flushoutput
If
-.Nm telnet
+.Nm
is in
.Ic localchars
mode (see
.It Ic forw1
.It Ic forw2
If
-.Tn TELNET
+.Nm
is operating in
.Dv LINEMODE ,
these are the
eol and eol2 characters.
.It Ic interrupt
If
-.Nm telnet
+.Nm
is in
.Ic localchars
mode (see
character.
.It Ic kill
If
-.Nm telnet
+.Nm
is in
.Ic localchars
mode (see
below),
.Ic and
if
-.Nm telnet
+.Nm
is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
character is typed, a
.Dv TELNET EL
character.
.It Ic lnext
If
-.Nm telnet
+.Nm
is operating in
.Dv LINEMODE
-or \*(Lqold line by line\*(Lq mode, then this character is taken to
+or \*(Lqold line by line\*(Rq mode, then this character is taken to
be the terminal's
.Ic lnext
character.
character.
.It Ic quit
If
-.Nm telnet
+.Nm
is in
.Ic localchars
mode (see
character.
.It Ic reprint
If
-.Nm telnet
+.Nm
is operating in
.Dv LINEMODE
-or \*(Lqold line by line\*(Lq mode, then this character is taken to
+or \*(Lqold line by line\*(Rq mode, then this character is taken to
be the terminal's
.Ic reprint
character.
.It Ic rlogin
This is the rlogin escape character.
If set, the normal
-.Tn TELNET
+.Nm
escape character is ignored unless it is
preceded by this character at the beginning of a line.
This character, at the beginning of a line followed by
a "." closes the connection; when followed by a ^Z it
-suspends the telnet command. The initial state is to
-disable the rlogin escape character.
+suspends the
+.Nm
+command. The initial state is to
+disable the
+.Nm rlogin
+escape character.
.It Ic start
If the
.Dv TELNET TOGGLE-FLOW-CONTROL
be the terminal's
.Ic start
character.
-The initial value for the kill character is taken to be
+The initial value for the start character is taken to be
the terminal's
.Ic start
character.
be the terminal's
.Ic stop
character.
-The initial value for the kill character is taken to be
+The initial value for the stop character is taken to be
the terminal's
.Ic stop
character.
.It Ic susp
If
-.Nm telnet
+.Nm
is in
.Ic localchars
mode, or
the terminal's
.Ic suspend
character.
-.ne 1i
.It Ic tracefile
This is the file to which the output, caused by
.Ic netdata
then tracing information will be written to standard output (the default).
.It Ic worderase
If
-.Nm telnet
+.Nm
is operating in
.Dv LINEMODE
-or \*(Lqold line by line\*(Lq mode, then this character is taken to
+or \*(Lqold line by line\*(Rq mode, then this character is taken to
be the terminal's
.Ic worderase
character.
the terminal's
.Ic worderase
character.
-.It Ic \&?
+.It Ic ?\&
Displays the legal
.Ic set
.Pq Ic unset
commands.
.El
-.It Ic slc Ar state
+.It Ic opie Ar sequence challenge
+The
+.Ic opie
+command computes a response to the OPIE challenge.
+.It Ic slc Ar state
The
.Ic slc
command (Set Local Characters) is used to set
-or change the state of the the special
-characters when the
+or change the state of the special
+characters when the
.Dv TELNET LINEMODE
option has
been enabled. Special characters are characters that get
-mapped to
+mapped to
.Tn TELNET
commands sequences (like
.Ic ip
Switch to the local defaults for the special characters. The
local default characters are those of the local terminal at
the time when
-.Nm telnet
+.Nm
was started.
.It Ic import
Switch to the remote defaults for the special characters.
The remote default characters are those of the remote system
-at the time when the
+at the time when the
.Tn TELNET
connection was established.
-.It Ic \&?
+.It Ic ?\&
Prints out help information for the
.Ic slc
command.
.El
.It Ic status
Show the current status of
-.Nm telnet .
+.Nm .
This includes the peer one is connected to, as well
as the current mode.
-.It Ic toggle Ar arguments ...
+.It Ic toggle Ar arguments ...
Toggle (between
.Dv TRUE
and
.Dv FALSE )
various flags that control how
-.Nm telnet
+.Nm
responds to events.
These flags may be set explicitly to
.Dv TRUE
sequences; see
.Ic set
above for details),
-.Nm telnet
+.Nm
refuses to display any data on the user's terminal
until the remote system acknowledges (via a
.Dv TELNET TIMING MARK
(autodecrypt) command states that encryption of the
output (input) stream should be enabled as soon as
possible.
-.sp
-.Pp
-Note: Because of export controls, the
-.Dv TELNET ENCRYPT
-option is not supported outside the United States and Canada.
.It Ic autologin
If the remote side supports the
.Dv TELNET AUTHENTICATION
option
-.Tn TELNET
+.Nm
attempts to use it to perform automatic authentication. If the
.Dv AUTHENTICATION
option is not supported, the user's login
.Dv TELNET ENVIRON
option.
This command is the same as specifying
-.Ar a
+.Fl a
option on the
.Ic open
command.
is sent as
.Ic abort ,
and
-.Ic eof and
-.B suspend
+.Ic eof
+and
+.Ic suspend
are sent as
-.Ic eof and
-.Ic susp ,
-see
+.Ic eof
+and
+.Ic susp
+(see
.Ic send
above).
.It Ic netdata
.Dv FALSE .
.It Ic options
Toggles the display of some internal
-.Nm telnet
+.Nm
protocol processing (having to do with
.Tn TELNET
options).
The initial value for this toggle is
.Dv FALSE .
-.ne 1i
.It Ic prettydump
When the
.Ic netdata
command will be formatted in a more user readable format.
Spaces are put between each character in the output, and the
beginning of any
-.Tn TELNET
+.Nm
escape sequence is preceded by a '*' to aid in locating them.
.It Ic skiprc
When the skiprc toggle is
.Dv TRUE ,
-.Tn TELNET
+.Nm
skips the reading of the
.Pa \&.telnetrc
file in the users home
directory when connections are opened. The initial
value for this toggle is
-.Dv FALSE.
+.Dv FALSE .
.It Ic termdata
Toggles the display of all terminal data (in hexadecimal format).
The initial value for this toggle is
.Ic verbose_encrypt
toggle is
.Dv TRUE ,
-.Tn TELNET
+.Nm
prints out a message each time encryption is enabled or
disabled. The initial value for this toggle is
-.Dv FALSE.
-Note: Because of export controls, data encryption
-is not supported outside of the United States and Canada.
-.It Ic \&?
+.Dv FALSE .
+.It Ic ?\&
Displays the legal
.Ic toggle
commands.
.El
.It Ic z
Suspend
-.Nm telnet .
+.Nm .
This command only works when the user is using the
.Xr csh 1 .
-.It Ic \&! Op Ar command
+.It Ic \&! Op Ar command
Execute a single command in a subshell on the local
system. If
-.Ic command
+.Ar command
is omitted, then an interactive
subshell is invoked.
-.It Ic \&? Op Ar command
+.It Ic ?\& Op Ar command
Get help. With no arguments,
-.Nm telnet
+.Nm
prints a help summary.
-If a command is specified,
-.Nm telnet
+If
+.Ar command
+is specified,
+.Nm
will print the help information for just that command.
.El
.Sh ENVIRONMENT
-.Nm Telnet
+.Nm
uses at least the
.Ev HOME ,
.Ev SHELL ,
to the other side via the
.Dv TELNET ENVIRON
option.
+.Sh SEE ALSO
+.Xr rlogin 1 ,
+.Xr rsh 1 ,
+.Xr hosts 5 ,
+.Xr nologin 5 ,
+.Xr telnetd 8
.Sh FILES
.Bl -tag -width ~/.telnetrc -compact
.It Pa ~/.telnetrc
.El
.Sh HISTORY
The
-.Nm Telnet
+.Nm
command appeared in
.Bx 4.2 .
-.Sh NOTES
.Pp
+IPv6 support was added by WIDE/KAME project.
+.Sh NOTES
On some remote systems, echo has to be turned off manually when in
\*(Lqold line by line\*(Rq mode.
.Pp
-In \*(Lqold line by line\*(Rq mode or
+In \*(Lqold line by line\*(Rq mode or
.Dv LINEMODE
the terminal's
.Ic eof