Telnet name
– user interface for the TELNET protocol telnet
synopsis
[-
8EFKLacdfrx] [-X authtype] [-b hostalias] [-e escapechar] [-k realm] [-l user] [-n tracefile] [ host [port]] Description The telnet command
is used to communicate with another host using the TELNET protocol. If telnet is invoked without the host argument, it enters command mode, indicated by its command prompt (telnet>). In this mode, you accept and execute the commands listed below. If invoked with arguments, performs an open command with those arguments.
The options are as follows:
-7‘ Strip 8th bit in input and output. Telnet is clean 8-bit by default, but does not send the TELNET BINARY option unless forced. -8‘ Specifies an 8-bit data path. This causes an attempt to trade the TELNET BINARY option on both entry and exit.
-E‘ Prevents any character from being recognized as an escape character.
-F‘ If Kerberos V5 authentication is used, the -F option allows you to forward local credentials to the remote system, including credentials that have already been forwarded to the local environment.
-K‘ Specifies that there is no automatic logon to the remote system.
-L‘ Specifies an 8-bit data path in the output. This causes the BINARY option to be traded on the exit.
–X atype Disables the authentication atype
type.
-a‘ Attempt automatic logon. Currently, this sends the username via the USER variable of the ENVIRON option if it is supported by the remote system. The name used is that of the current user returned by getlogin(2) if you agree with the current user ID, otherwise it is the name associated with the user ID.
-b hostalias Uses bind(2) on the local socket to bind it to an aliased address (see ifconfig(8) and the ”alias” specifier) or to the address of another interface than the one naturally chosen by connect(2). This can be useful when connecting to services that use IP addresses for server authentication and reconfiguration is undesirable (or impossible).
-c‘ Disables reading of the . user telnetrc. (See the toggle skiprc command on this man page.)
-d‘ Sets the initial value of the debug switch to TRUE
.
-e escape Sets the initial telnet escape character to escapechar. If escape is omitted, then there will be no escape character.
-f‘ If Kerberos V5 authentication is used, the –f option allows local credentials to be forwarded to the remote system. -k realm If Kerberos authentication is used
, the –
k option requests that telnet obtain tickets for the remote host in the domain domain instead of the domain of the remote host, as determined by krb_realmofhost(3).
-l user When connecting to the remote system, if the remote system understands the ENVIRON option, then the user will be sent to the remote system as the value of the USER variable. This option implies the -a option. This option can also be used with the open command.
-n tracefile Opens tracefile to record trace information. See the set tracefile command below.
-r‘ Specifies a user interface similar to rlogin(1). In this mode, the escape character is set to the tilde (~) character, unless modified by using the -e option.
-x‘ Enables encryption of the data stream if possible
. host’ Indicates
the official name, alias, or Internet address of a remote host. port’ Indicates a
port number (address of an application). If a number is not specified, the default telnet port is used.
When in rlogin mode, a line of the form ~. is disconnected from the remote host; ~ is the telnet escape character. Similarly, the ~^Z line suspends the telnet session. The line ~^] escapes the normal telnet escape indicator.
Once a connection has been opened, telnet will attempt to enable the TELNET LINEMODE option. If this fails, telnet will revert to one of two input modes: ”character at a time” or ”old line by line” depending on what the remote system supports.
When LINEMODE is enabled, character processing is performed on the local system, under the control of the remote system. When input editing or character echo is to be disabled, the remote system will transmit that information. The remote system will also transmit changes to special characters that occur on the remote system, so that they can take effect on the local system.
In ”
character at a time” mode, most of the typed text is immediately sent to the remote host for processing.
In ”old line
by line” mode, all text is repeated locally and (usually) only completed lines are sent to the remote host. The ”local echo character” (initially ”^E”) can be used to turn the local echo off and on (this would mainly be used to enter passwords without the password being echoed).
If the LINEMODE option is enabled, or if the localchars switch is TRUE (the default for ”old line by line”; see below), the user’s quit, intr, and flush characters are captured locally and sent as TELNET protocol streams to the remote side. If LINEMODE has ever been enabled, then the user’s susp and eof are also sent as TELNET protocol streams, and quit is sent as TELNET ABORT instead of BREAK. There are options (see toggle autoflush and toggle autosynch below) that cause this action to flush the post-terminal output (until the remote host recognizes the TELNET stream) and flush the previous terminal input (in the case of quit and intr).
While connected to a remote host, telnet command mode can be entered by typing the telnet escape character ”’ (initially ”^]”). When in command mode, normal terminal editing conventions are available. Note that the escape character will return to the command mode of the initial telnet invocation that the control terminal has. Use the send escape command to switch to command mode in subsequent telnet processes on remote hosts.
The following telnet commands are available. Only enough of each command needs to be written to uniquely identify it (this also applies to the arguments of the mode, set, toggle, unset, slc, environ, and display commands).
Authentication argument […] The auth command manipulates the information sent through the TELNET AUTHENTICATE option. The valid arguments for the auth command are as follows:
disable type Disables the specified type of authentication. For a list of available types, use the auth disable ? command.
enable type Enables the specified authentication type. For a list of available types, use the auth enable ? command.
status‘ Lists the current status of the various authentication types
.
close‘ Close a TELNET session and return to command mode.
show argument […] Displays all, or some, set and alternation values (see below).
Encrypt Argument […] The encrypt command manipulates information sent through the TELNET ENCRYPT option.
The valid arguments for the encrypt command are as follows:
disable the type [input|output] Disables the specified encryption type. If you skip in and out, both in and out are disabled. For a list of available types, use the encrypt disable ? command.
enable type [input|output] Enables the specified encryption type. If you skip in and out, both in and out are enabled. For a list of available types, use the encrypt enable ? command.
input’ This is the same as the encrypt start input command. -input’ This is the same as the encrypt stop input command. output’ This is the same as the encrypt start output command.
–output’ This is the same as the encrypt stop output command
. start
[input|output] Attempts to start encryption. If you skip in and out, both in and out are enabled. For a list of available types, use the encrypt enable ? command.
status‘ Displays the current status of the
encryption.
stop [input|output] Stops encryption. If you skip the input and output, the encryption is both in the input and output.
type
type‘ Sets the default type of encryption to use with the subsequent encrypt start or encrypt stop commands.
Environmental arguments […] The environ command is used to manipulate variables that can be sent through the ENVIRON TELNET option. The initial set of variables is taken from the users’ environment, and only the DISPLAY and PRINTER variables are exported by default. The USER variable is also exported if the –a or -l options are used. Valid arguments for the environ command are:
set variable value Set the variable variable to have a value of value. All variables defined by this command are automatically exported. The value can be enclosed in single or double quotation marks so that tabs and spaces can be included.
undefine variable Remove variable from the list of environment variables. export variable Check the variable variable to
export to the
remote side.
unexport variable Check the variable variable so that it is not exported unless explicitly requested by the remote side
. list’ List
the current set of environment variables.
Those marked with an * will be sent automatically, other variables will only be sent if explicitly requested.
? ‘ Prints help information for the environ command.
logout‘ Sends the TELNET LOGOUT option to the remote side. This command is similar to a close command; however, if the remote side does not support the LOGOUT option, nothing happens. However, if the remote side supports the LOGOUT option, this command should cause the remote side to close the TELNET connection. If the remote side also supports the concept of suspending a user’s session and reconnecting it later, the logoff argument indicates that you should terminate the session immediately.
mode type type is one of several options, depending on the state of the TELNET session. Permission is requested from the remote host to enter the requested mode. If the remote host is able to enter that mode, the requested mode is entered.
character’ Disable the TELNET LINEMODE option or, if the remote side does not understand the LINEMODE option, enter ”character at a time” mode. line’ Enable the TELNET LINEMODE option
or, if the remote side does not understand the LINEMODE option, try entering ”old-line-by-line”
mode. isig (-isig) Try to enable (disable) the TRAPSIG
mode of the LINEMODE option.
This requires that the LINEMODE option is enabled.
edit (
-edit) Try to enable (disable) the EDIT mode of the LINEMODE option. This requires that the LINEMODE option is enabled.
softtabs (-softtabs) Try to enable (disable) SOFT_TAB mode of the LINEMODE option. This requires that the LINEMODE option is enabled.
litecho (-litecho) Try to enable (disable) the LIT_ECHO mode of the LINEMODE option. This requires that the LINEMODE option is enabled.
? ‘ Prints help information for the mode command.
open host [-l user] [ [–] port] Open a connection to the designated host. If no port number is specified, telnet will attempt to contact a TELNET server on the default port. The host specification can be a host name (see hosts(5)) or an Internet address specified in ”dot notation” (see inet(3)). The -l option can be used to specify the user name to be passed to the remote system through the ENVIRON option. When connected to a non-standard port, telnet bypasses any automatic start of TELNET options. When the port number is preceded by a minus sign, the initial negotiation of the option takes place. After you establish a connection, the . telnetrc in the user’s home directory. Lines beginning with ”#” are comment lines. Blank lines are ignored. Lines that begin without white space are the start of a machine entry. The first thing on the line is the name of the machine you are connecting to. The rest of the line and successive lines that begin with blank spaces are assumed to be telnet commands and are processed as if they were manually typed at the telnet prompt.
quit‘ Close any open TELNET sessions and exit telnet. An end of file (in command mode) will also log out and exit.
send arguments Sends one or more sequences of special characters to the remote host. The following are the arguments that can be specified (more than one argument can be specified at a time):
abort Sends the sequence TELNET ABORT (Abort processes). ao’ Sends the TELNET
AO (Abort Output) stream, which should cause the remote system to empty all output from the remote system to the user’s terminal. ayt’ Sends the TELNET
sequence AYT (
Are You There), to which the remote system may or may not choose to respond.
brk
‘ Sends the TELNET sequence BRK (Interrupt), which may be important to the remote system. ec’ Sends the sequence TELNET EC (Clear Character), which should cause the remote system to delete the last character entered. the’ Sends the sequence TELNET
EL (Erase Line), which should cause the remote system to clear the line that is currently being entered. eof’ Sends the sequence
TELNET EOF (End Of File).
eor‘ Sends the TELNET EOR (End of Record) stream.
escape
Sends the current telnet escape character (initially ”^]”).
ga’ Sends the TELNET
GA (Go Ahead) stream, which probably has no significance
to the remote system. getstatus If the remote side supports the TELNET
STATUS command, getstatus will send the subnegotiation to request that the server send its current option status
.
ip‘ Sends the TELNET IP (interrupt process) stream, which should cause the remote system to abort the currently running process.
nop ‘ Sends the TELNET NOP (No OPeration) stream.
susp‘ Sends the SUSP stream (SUSPend process) from TELNET
.
synch Sends the TELNET SYNCH stream. This sequence causes the remote system to discard all previously written (but not yet read) entries. This stream is sent as urgent TCP data (and may not work if the remote system is a 4.2BSD system – if it does not work, a lowercase ”r” can be repeated in the terminal).
do cmd Sends the cmd TELNET DO sequence. cmd can be a decimal number between 0 and 255, or a symbolic name for a specific TELNET command. cmd can also be help or ? to print help information, including a list of well-known symbolic names.
don’t cmd Sends the TELNET sequence DONT cmd. cmd can be a decimal number between 0 and 255, or a symbolic name for a specific TELNET command. cmd can also be help or ? to print help information, including a list of well-known symbolic names.
will cmd Sends the cmd sequence TELNET WILL. cmd can be a decimal number between 0 and 255, or a symbolic name for a specific TELNET command. cmd can also be help or ? to print help information, including a list of well-known symbolic names.
wont cmd Sends the WONT cmd TELNET sequence. cmd can be a decimal number between 0 and 255, or a symbolic name for a specific TELNET command. cmd can also be help or ? to print help information, including a list of well-known symbolic names.
? ‘ Prints help information for the send
command. set argument value
unset argument
value
The set command will set any of several telnet variables to a specific value or to TRUE. The special value off disables the feature associated with the variable; This is equivalent to using the unset command. The unset command will disable or set any of the specified functions to FALSE. The values of the variables can be interrogated with the display command. Variables that can be set or disabled, but not activated, are listed here. In addition, any of the variables for the toggle command can be explicitly set or deconfigured using the set and unset commands.
ayt‘ If TELNET is in localchars mode, or LINEMODE is enabled, and the status character is written, an AYT TELNET stream (see send previous ayt) is sent to the remote host. The initial value for the character “Are You There” is the terminal state character.
echo’ This is the value (initially ”^E”) that, when in ”line by line” mode, alternates between locally echoing the entered characters (for
normal processing) and suppressing the echo of the entered characters (to enter, for example, a password).
eof‘ If telnet is operating in LINEMODE or ”old line by line” mode, when you enter this character as the first character on a line, this character will be sent to the remote system. The initial value of the eof character is taken as the eof character of the terminal.
clearing If telnet is in localchars mode (see
toggle localchars below) and if telnet operates in ”character at a time” mode, when this character is typed, an EC TELNET stream (see send ec above) is sent to the remote system. The initial value for the delete character is taken as the terminal delete character’s. escape This is the
telnet escape character (initially ”
^[”) that causes entry into telnet command mode (when connecting to a remote system).
flushoutput If telnet is in localchars mode (see toggle localchars below) and the flushoutput character is typed, an AO TELNET stream (see send ao above) is sent to the remote host. The initial value for the flush character is taken as the flush character of the terminal’s.
forw1 forw2
If TELNET is operating in LINE mode, these are the characters that, when typed, cause partial lines to be forwarded to the remote system. The initial value for forwarding characters is taken from the eol and eol2 characters in the terminal.
If telnet is in localchars mode (see toggle localchars below) and the interrupt character is typed, a TELNET IP stream (see send ip above) is sent to the remote host. The initial value for the interrupt character is taken as the intr character of the terminal.
kill’ If telnet is in localchars mode (see
toggle localchars below), and if telnet is running in ”character at a time” mode, when this character is typed, an EL TELNET sequence (see send above) is sent to the remote system. The initial value for the kill character is taken as the kill character of the terminal.
lnext If telnet is operating in LINEMODE or ”old line by line” mode, then this character is taken as the lnext character of the terminal’s. The initial value for the lnext character is taken as the lnext character of terminal’s.
quit‘ If telnet is in localchars mode (see toggle localchars below) and the quit character is typed, a BRK TELNET stream (see send brk above) is sent to the remote host. The initial value of the quit character is taken as the output character of the terminal’s.
reprint If telnet is running in LINEMODE mode or in old line-by-line” mode, then this character is taken as the terminal reprint character. The initial value for the reprint character is taken as the reprint character of the terminal.
rlogin This is the rlogin escape character. If set, the normal TELNET 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 suspends the telnet command. The initial state is to disable the rlogin escape character.
Home If the TELNET TOGGLE-FLOW-CONTROL option is enabled, this character is considered to be the start character of the terminal. The initial value for the start character is taken as the start character of the terminal.
stop‘ If the TELNET TOGGLE-FLOW-CONTROL option is enabled, this character is considered to be the stop character of the terminal. The initial value for the stop character is taken as the stop character of the terminal’s.
susp‘ If telnet is in localchars mode, or LINEMODE is enabled, and the suspend character is written, a SUSP TELNET stream (see send susp above) is sent to the remote host. The initial value for the suspend character is taken as the terminal‘s sleep character.
tracefile This is the file to which the output will be written, caused by netdata or TRUE option tracking. If set to ”–”, trace information will be written to the standard output (default).
worderase If telnet is operating in LINEMODE or ”old line by line” mode, then this character is taken as the worderase character of the terminal’s. The initial value for the worderase character is taken as the worderase character of the terminal’s.
? ‘ Displays the legal set (unset) commands.
skey sequence challenge The skey command calculates a response to the S/Key challenge. See skey(1) for more information on the S/Key system.
slc state The Set Local Characters (slc) command is used to set or change the state of special characters when the TELNET LINEMODE option has been enabled. Special characters are characters that are mapped to TELNET scripts (such as ip or quit) or line editing characters (such as delete and kill). By default, local special characters are exported.
check‘ Check the current settings for the current special characters. The remote side is prompted to send all current special character settings, and if there is any discrepancy with the local side, the local side will change to the remote value.
export‘ Change to local defaults for special characters. The local default characters are those of the local terminal at the time telnet was started.
import‘ Change to remote defaults for special characters. The remote default characters are those of the remote system at the time the TELNET connection was established.
? ‘ Prints help information for the slc command.
status‘ Display the current telnet status. This includes the pair you are connected to, as well as the current mode.
toggle arguments […] Toggle (between TRUE and FALSE) multiple flags that control how telnet responds to events. These flags can be explicitly set to TRUE or FALSE using the set and unset commands listed above. You can specify more than one argument. The status of these flags can be interrogated with the display command. Valid arguments are:
authdebug‘ Enables debugging information for the authentication code.
autoflush
‘ If autoflush and localchars are TRUE, then when the characters ao or quit are recognized (and transformed into TELNET streams; see set above for details), telnet refuses to display any data on the user’s terminal until the remote system recognizes (via a TELNET TIMING MARK option) that it has processed those TELNET streams. The initial value of this switch is TRUE if the terminal user has not performed a “stty noflsh”, otherwise FALSE (see stty(1)).
autodecrypt When the TELNET ENCRYPT option is negotiated, by default the actual encryption (decryption) of the data stream does not start automatically. The autoencrypt command indicates that encryption of the output (input) stream should be enabled as soon as possible.
automatic
logon‘ If the remote side supports the TELNET AUTHENTICATION option, TELNET attempts to use it to perform automatic authentication. If the AUTHENTICATION option is not supported, the user’s logon name is propagated through the ENTON TELNET option. This command is the same as specifying an option in the open command.
autosynch‘ If autosynch and localchars are TRUE, when the intr or quit character is typed (see the set above for descriptions of the intr and quit characters), the resulting TELNET stream sent is followed by the TELNET SYNCH stream. This procedure should cause the remote system to start discarding all previously written entries until both TELNET streams have been read and acted upon. The initial value of this switch is FALSE.
binary’ Enable or disable the TELNET BINARY option on both input and output. inbinary’ Enable or disable the TELNET BINARY option on the input.
outbinary‘ Enable or disable the TELNET BINARY option in the output
.
crlf‘ If this is TRUE, carriage returns will be sent as <CR><LF>. If this is FALSE, cart returns will be sent as <CR><NUL>. The initial value of this switch is FALSE.
crmod‘ Toggle the carriage return mode. When this mode is enabled, most carriage return characters received from the remote host will be mapped to a carriage return followed by a line feed. This mode does not affect characters typed by the user, only those received from the remote host. This mode is not very useful unless the remote host only sends carriage return, but never line breaks. The initial value of this switch is FALSE.
debug‘ Toggles socket-level debugging (useful only for superuser). The initial value of this switch is FALSE.
encdebug‘ Enables information purging for the encryption code.
localchars‘ If this is TRUE, then the flush, interrupt, quit, erase, and kill characters (see set above) are recognized locally and transformed into (hopefully) appropriate TELNET control streams (respectively ao, ip, brk, ec, and el; see send above). The initial value of this switch is TRUE in ”old line by line” mode and FALSE in ”character at a time” mode. When the LINEMODE option is enabled, the localchars value is ignored and assumed to always be TRUE. If LINEMODE has ever been enabled, quit is sent as abort, and eof and suspend are sent as eof and susp (see send above).
netdata‘ Toggles the display of all network data (in hexadecimal format). The initial value of this switch is FALSE.
options‘ Toggles the display of some internal processing of the telnet protocol (which has to do with TELNET options). The initial value of this switch is FALSE.
prettydump‘ When the netdata switch is enabled, if prettydump is enabled, the output of the netdata command will be formatted in a more user-readable format. Spaces are placed between each character in the output, and the beginning of any TELNET escape sequence is preceded by a ‘*’ to help locate them.
skiprc‘ When the skiprc switch is TRUE, TELNET skips reading the . telnetrc in the user’s home directory when connections are opened. The initial value of this switch is FALSE.
termdata‘ Toggles the display of all terminal data (in hexadecimal format). The initial value of this switch is FALSE.
verbose_encrypt When the verbose_encrypt switch is TRUE, telnet prints a message each time encryption is enabled or disabled. The initial value of this switch is FALSE.
? ‘ Displays the legal toggle commands.
z‘ Suspend telnet. This command only works when the user is using the csh(1).
! [command] Run a single command in a subshell on the local system. If the command is omitted, an interactive subshell is invoked.
? [command] Get help. Without arguments, telnet prints a help summary. If a command is specified, telnet prints the help information for that command only.
Environment telnet uses at least the HOME, SHELL, DISPLAY, and TERM environment variables. Other environment variables can be propagated to the other side via the ENVIRON TELNET option.
~
/.telnetrc files custom user telnet startup values
History
The telnet command appeared in 4.2BSD
.
Notes
On some remote systems, echo must be manually disabled when
in ”old line by line” mode. In ”old line by line’
‘ or LINEMODE mode, the terminal eof character is only recognized (and sent to the remote system) when it is the first character on a line
.
Source routing does not yet support IPv6.
BSD
February 3, 1994 BSD
Referenced by
c3270(1), cloginrc(5), cytune(8), forward(1), lg.conf(5), nc(1), ping(8), pmdacisco(1), powwow(6), pr3287(1), pty(7), qodem(1), rancid.conf(5), remtty(1), router.db(5), ser2net(8), sge_conf(5), submit(1), tcpconnect(1), tcplisten(1), telnet-chatd(1), telnet-client(1), telnet-probe(1), telnet-proxy(1), telnetd(8), virt-rescue(1), x3270(1), ztelnet(1)