telnet
user interface to the TELNET† protocol
telnet [-468EFKLNacdfruxy] [-S tos] [-X authtype] [-e escapechar] [-k realm]
[-n tracefile]
[-s src_addr]
[-l user]
[host [port]]
Communicate to a login shell at host
using the TELNET protocol ( or other service
).
See ssh for encrypted communication.
Various implemention support many but not necessarily all of the options and commands
Without host
, enters command mode, prompts with telnet>
, accepts and executes commands.
With arguments, it performs an open
with those arguments.
-l user | user will be sent to the remote system as the value for the variable USER . implies -. a
May be used with the open command.
|
-N No IP address lookup
-4 IPv4 addresses only.
| -6 IPv6 addresses only.
| -8 8-bit data path, causes negotiating the TELNET BINARY option on both input and output.
| -L 8-bit data path on output, causes the BINARY option to be negotiated on output.
| -S tos Sets IP type-of-service (TOS) (numeric or symbolic) found in the /etc/iptos file.
| -X atype Disables atype authentication.
| -d Sets debug to TRUE.
|
-f If Kerberos V5 authentication is being used, local credentials are forwarded to the remote system.
| -F " " including any credentials that have already been forwarded into the local environment.
| -k realm With Kerberos authentication: obtain tickets for the remote host in realm instead of the remote host's realm, as determined by krb_realmofhost (3).
|
-n tracefile Opens tracefile. See set tracefile
| -s src_addrSet source IP address or a host .
| -u use AF_UNIX addresses only (e.g., UNIX domain sockets, accessed with a file path).
| -y Suppresses encryption of the data stream.
| -e ec Set escape character to invoke command mode .
If ec is omitted, there will be no escape character.
| -E No escape character .
| -K No automatic login
| host name, alias, or the Internet address of a host. If host
starts with / , establishes a connection to the named socket.
| port port number Default telnet port (20 )is.
This can be used for debugging many protocols since many use a plain text exchange.
For example telnet host 25 will
connect to host Simple Mail Transport Protocol (SMTP, outgoing email) application which expects commands like
HELP, HELO,EHLO, MAIL FROM, SEND FROM, DATA … ( See nc)
Another example is to test connection to a QL server using telnet host
-c Disables .telnetrc . See skiprc
| | | | | | | | | | | | | | | | | | | | | | | |
In rlogin mode, a line of the form
~.
disconnects from the host; (~
is the default escape character).
~^Z
suspends the session.
~^]
escapes to the escape prompt.
Once a connection has been opened, enables TELNET LINEMODE .
If that fails revert to character at a time or old line by line.
In character at a time mode, most text typed is immediately sent to the remote host for processing and echoing.
With LINEMODE
character processing is done on the local system, under the control of the
remote system. When input editing or character echoing is to be disabled, the remote system will relay
that information. The remote system will also relay changes to any special characters that happen on
the remote system, so that they can take effect on the local system.
In old line by line mode, all text is echoed locally, and (normally) lines are sent when completed.
The local echo toggle character (initially ^E) turns off and on the
local echo (frequently used to supress echoing of passwords ).
With LINEMODE
or if localchars
is TRUE (default for old line by
line; see below), the user's quit, intr
, and flush
characters are trapped locally, and sent as TELNET
protocol sequences.
If LINEMODE
has ever been enabled, then susp
and eof
are also sent as TELNET protocol sequences, and quit
is sent as a TELNET ABORT
instead of BREAK
.
Options toggle autoflush
and toggle autosynch
cause this action to flush subsequent output to the terminal
(until the remote host acknowledges the TELNET sequence) and flush previous terminal input (in the case of quit
and intr
).
command mode is entered by typing the escape character (initially ^]) where normal line editing is available.
Only enough of each command to uniquely identify it need
be typed (also true for arguments to mode, set, toggle, unset, slc, environ, and display
).
A null command returns to connnected host.
open host [-l user] [[-]port]
| name, address in dot notation, or IPv6 coloned-hexadecimal addreess.
-l login user name passed to the remote system via ENVIRON .
When port is preceded by a minus sign, the initial option negotiation is done.
When connecting to a port other than 22, no automatic initiation of TELNET options is performed.
After establishing a connection, .telnetrc in the users home directory is executed.
$n is replaced by the corresponding argument on the macro invocation command line.
| $i is a loop index . On the first pass $i is replaced by arg1 and the macro is executed.
on the second pass arg2 …
| use \$ to specify a $
|
Trying 192.168.1.14...
Connected to dapi2.germans.
Escape character is '^]'.
|
quit
| close and return to command mode.
| logout Sends the TELNET LOGOUT to the remote side, similar to a close .
Causes the remote to close the connection.
Suspending a user's session for later reattachment, the logout argument indicates terminate the session immediately.
| auth display authenticaton types+OK
PLAIN
LOGIN
.
| auth enable|disable type
manipulates the TELNET AUTHENTICATE option.
To a list of available type s, use auth disable ?
auth disable 'type'
Where 'type' is one of:
NULL
KERBEROS_V5
| auth status Lists the current status of the various types of authentication.
Authentication enabled
KERBEROS_V5: enabled
KERBEROS_V4: enabled
| encrypt argument …
Not always implementeed
disable
enable type [input | output] Omitting input or output ,
both are disabled.
To list available types : encrypt disable ?
| start
stop [input | output]Omitting input or output both are encrypted.
| input/
-input start/stop input
output/
-output start/stop output
status
| type type Sets the default type
| | | | | | | | |
| environ args …
Initial variables are populated with: USER, PRINTER†, DISPLAY, TERM, COLUMNS, LINES .
Only USER, PRINTER, DISPLAY are exported by default.
define variable [value] | If value is empty, the
value is taken from the environment variable.
variable s are exported.
The value may be enclosed in apostrophes or quotes.
| undefine variable Remove variable from the list of environment variables.
| export variable Mark variable to be exported to the remote side.
| unexport variable Mark variable to not be exported unless explicitly asked for by the
remote side.
| list
|
Those marked with * will be sent, otherwise only be sent if explicitly requested.
LINES 36
COLUMNS 140
TERM xterm-256color
* DISPLAY /private/tmp/com.apple.launchd.juL7Oc/org.macosforge.xquartz:0
USER myname
| ? output help for environ
| | | | | |
| mode type
character Disable TELNET LINEMODE. enter character at a time mode.
| line Enable TELNET LINEMODE or old-line-by-line mode.
in LINEMODE
| [-]isig enable (disable) TRAPSIG
[-]edit enable (disable) EDIT
[-]softtabs enable (disable) SOFT_TAB
[-]litecho enable (disable) LIT_ECHO
| | | | | | | |
| ? output help for mode .
| | | |
| send arguments … After sending arguments , returns to transparent state.
ayt Are You There reply: [ hostname : yes ] or no response
| brk Break . May invoke SIGQUIT
| ec Erase Character . Erases the last character entered.
| el Erase Line . Erases the line currently being entered.
| eof End Of File
| eor End of Record
| escape current escape character, initially ^[ (to command prompt).
| ga Go Ahead
| getstatus get server current option status. RCVD IAC SB STATUS IS
WILL ECHO
WILL SUPPRESS GO AHEAD
WILL STATUS
DO TERMINAL TYPE
DO NAWS
DO TSPEED
DO LFLOW
DO NEW-ENVIRON
SB TOGGLE-FLOW-CONTROL ON SE
| nop No Operation
| abort Abort processes Sends SIGQUIT
| ao Abort Output causes the remote system to flush buffered output
| ip Interrupt Process abort the currently running process.
| susp SUSPend process | synch discard all previously typed (but not yet read) input.
sent as TCP urgent data. If ignored a lower case r may be echoed on the terminal.
| do cmd
dont cmd
will cmd
wont cmd cmd is the name for a TELNET command or decimal number between 0 and 255, or
? for help including a list of commands.
Valid options are:
BINARY ECHO RCP "SUPPRESS GO AHEAD" NAME
STATUS "TIMING MARK RCTE NAOL NAOP NAOCRD
NAOHTS NAOHTD NAOFFD NAOVTS" NAOVTD NAOLFD
"EXTEND ASCII" LOGOUT "BYTE MACRO"
"DATA ENTRY TERMINAL" "SUPDUP" "SUPDUP OUTPUT"
"SEND LOCATION" "TERMINAL TYPE" "END OF RECORD"
"TACACS UID" "OUTPUT MARKING" TTYLOC "3270 REGIME"
"X.3 PAD" NAWS TSPEED LFLOW LINEMODE XDISPLOC
OLD-ENVIRON AUTHENTICATION ENCRYPT NEW-ENVIRON
| ? outputs send arguments as per above.
| | | | | | | | | | | | | | | | | |
| display argument ... Displays set and toggle values
example:
telnet> display ayt Are You There
ayt [^T]
telnet> display
will flush output when sending interrupt characters.
won't send interrupt characters in urgent mode.
will send login name and/or authentication information.
won't skip reading of ~/.telnetrc file.
won't map carriage return on output.
will recognize certain control characters.
won't turn on socket level debugging.
won't print hexadecimal representation of network traffic.
won't print user readable output for "netdata".
won't show option processing.
won't print hexadecimal representation of terminal traffic.
following reformated
echo [^E] escape [^]]
rlogin [off]
tracefile "(standard output)"
flushoutput [^O] interrupt [^C] quit [^\]
eof [^D] erase [^?] kill [^U]
lnext [^V] susp [^Z] reprint [^R]
worderase [^W] start [^Q] stop [^S]
forw1 [off] forw2 [off]
ayt [^T]
set code value|TRUE|off
unset code value|TRUE|off
variables which may be set or unset , but not toggled
variables for toggle command may be set or unset
code | initial value |
| escape ^[enters command mode
| echo ^Ein line by line mode, toggles local echo of entered characters (for normal processing), and suppressing echoing (for example when entering, a password)
| eof ^Din LINEMODE or old line by line mode, as the first character on a line, causes this character to be sent
| forw1
forw2 | in LINEMODE, cause partial lines to be forwarded
| lnext ^V in LINEMODE or old line by line mode
| ayt ^T in localchars mode, or LINEMODE , status character. Sends TELNET AYT
| affect input
| erase ^?in localchars mode and operating in character at a time mode, sends TELNET EC
| worderase^W | in LINEMODE or old line by line mode,
| affect output
| kill ^Uin localchars mode and operating in character at a time mode, sends TELNET EL
| stop ^S If TOGGLE-FLOW-CONTROL is enabled
| start ^Q If TOGGLE-FLOW-CONTROL is enabled
| flushoutput^O In localchars mode, sends TELNET AO
| request action
| susp ^Z in localchars mode, or LINEMODE is enabled, TELNET SUSP is sent.
| interrupt^Cin localchars mode send TELNET IP
| quit ^\ localchars mode sends TELNET BRK
| reprint^Rin LINEMODE or old line by line mode,
| rlogin off | If set, the escape character is ignored unless preceded by this character at the beginning of a line.
At the beginning of a line followed by a "." closes the connection to be suspended
When followed by a ^Z suspends the telnet command.
| tracefile- | filename to which the output, of netdata or tracing
If - , then tracing information is written to standard output
| ? | Displays the legal set (unset) commands.
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| slc state Set Local Characters
in LINEMODE Special characters are characters mapped to TELNET commands sequences (like ip or quit )
or line editing characters (like erase and kill ).
Default: exported.
state
check Verify the current settings for the current special characters. The remote side
is requested to send all the current special character settings, and if there
are any discrepancies with the local side, the local side will switch to the remote value.
Special characters are remote values
| export Switch to the local defaults for the special characters. The local default
characters are those of the local terminal at the time when telnet was started.
Special characters are local values
| 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 TELNET connection
was established.Special characters are remote default values
| ? output this help information for the slc command.
| | | | |
| status Show the current status of telnet. This includes the peer one is connected to, as well as the current mode.
| toggle arguments ... use set and unset to explicitly set TRUE or FALSE
More than one argument may be specified. The state of these flags may be interrogated with the display command.
authdebug Turns on debugging for the authentication code.
| autoflush If autoflush and localchars are both TRUE, then when the ao, or quit characters are recognized (and transformed into TELNET sequences; telnet refuses to display any data on the user's terminal until the
remote system acknowledges (via a TELNET TIMING MARK option) that it has processed those TELNET sequences.
Initaly TRUE if the terminal user had not done an stty noflsh ", otherwise FALSE (see stty
| autodecrypt When the TELNET ENCRYPT option is negotiated, by default the actual encryption
(decryption) of the data stream does not start automatically.
The autoencrypt (autodecrypt) command states that encryption of the output (input) stream should be enabled as soon as possible.
| autologin 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 login name are propagated through the TELNET
ENVIRON option. This command is the same as specifying -a option on the open command.
| autosynch If autosynch and localchars are both TRUE, then when either the intr or quit
characters is typed (see set above for descriptions of the intr and quit characters), the resulting TELNET sequence sent is followed by the TELNET SYNCH
sequence. This procedure should cause the remote system to begin throwing
away all previously typed input until both of the TELNET sequences have been
read and acted upon.
Initally FALSE.
| binary
inbinary
outbinary Enable or disable the TELNET BINARY option on i/o, input, output.
| crlf carriage returns will be sent as ␍␊
FALSE, then carriage returns will be sent as ␍␀
initially FALSE ␍␀.
| crmod Toggle carriage return mode.
When enabled, most carriage returns received will be mapped into a carriage return followed by a line feed.
Does not affect those characters typed by the user.
This mode is not very useful unless the remote host only sends carriage return, but never line feed.
Initially FALSE.
| debug Toggles socket level debugging (useful only to the super user), initally FALSE.
| encdebug Turns on debugging information for the encryption code.
| localchars If TRUE, flush, interrupt, quit, erase, and kill characters
are recognized locally, and transformed into
appropriate TELNET control sequences (respectively ao, ip, brk, ec and el
Initially TRUE in old line by line mode, and
Initially FALSE in character at a time mode.
When LINEMODE is enabled, the value of localchars is ignored, and assumed to always be TRUE.
If LINEMODE has ever been enabled, then quit is sent as abort, and eof and suspend are sent as eof and susp (see send above).
| termdata Toggles the display of terminal data (in hexadecimal ), initially FALSE.
| netdata Toggles the display of network data (in hexadecimal ), initially FALSE.
| prettydump When netdata is enabled, more user readable format, i.e. spaces
are put between each character in the output, and the beginning of any telnet
escape sequence is preceded by a * to aid in locating them.
| skiprc skips the reading of .telnetrc , initially FALSE.
| verbose_encryptoutput a message each time encryption is enabled or disabled. initially FALSE.
| ? Displays toggle commands.
| | | | | | | | | | | | | | | | | |
| opie sequence challengecomputes a response to the One time Passwords In Everything (
OPIE challenge).
| z Suspend telnet. resume with fg
| ! [command] Execute a single command in a subshell on the local system.
If command is omitted, then an interactive subshell is invoked.
| options Toggles the display of some internal telnet protocol processing, initially FALSE.
| ? [command] With no arguments, outputs a summary of commands.
If command is specified, outputs the help information for that command.
| | | | | | | | | | | | | | | | | | | | | |
ENVIRONMENT
Telnet uses at least the HOME, SHELL, DISPLAY, and TERM
environment variables.
Other environment variables may be propagated to the other side via the TELNET ENVIRON option.
SEE ALSO
rlogin(1), rsh(1), hosts(5), nologin(5), telnetd(8)
FILES
~/.telnetrc
user customized telnet startup values
Lines beginning with a # are comment lines. Blank lines are ignored.
Lines that begin without white space are the start of a machine entry.
machine The rest of the line, and successive lines that
begin with white space are telnet commands ..
HISTORY
The telnet command appeared in 4.2BSD.
IPv6 support was added by WIDE/KAME project.
On some remote systems, echo has to be turned off manually when in old line by line mode.
In old line by line mode or LINEMODE the terminal's eof character is only recognized (and sent to
the remote system) when it is the first character on a line.
The /etc/iptos
file configures the Type Of Service (TOS) of the Internet
Protocol (IP) used by FTP and Telnet.
The TOS field in the Internet datagram is to specify how the datagram
should be handled. It is a mechanism to allow control information to have
precedence over data.
Generally, protocols that are involved in direct interaction with a human
should select low delay, while data transfers that involve large blocks of
data need high throughput.
Finally, high reliability is most important for
datagram-based Internet management functions.
In the Tru64 UNIX operating system, the ftp and telnet applications and the
ftpd and telnetd daemons allow the configuring of TOS
values.
If the file does not exist, the applications default to recommended by RFC1060:
ftp-control Low delay
ftp-data High throughput
telnet Low delay
Users who want to configure their own TOS values for the TOS field should
provide the /etc/iptos file.
Most IP routers do not differentiate based on TOS, and therefore providing
values other than the default would have no affect. Digital does not
recommend changing the default values for FTP and Telnet.
Application Proto TOS-bits aliases
|
Application The name of an application TOS entry.
| Proto The protocol name for which the entry is appropriate.
| TOS-bits The TOS value to be set for the entry.
| aliases A list of aliases that exist for the entry.
| | | | |
Items on an entry line are separated by any number of blanks, tabs, or
combination of blanks and tabs. A number sign (#) indicates that the rest
of the line is a comment and is not interpreted by routines that search the
file. Blank lines in the file are ignored.
Valid TOS entry names are ftp-control
and ftp-data
for FTP and telnet
for Telnet.
The TOS value for the entry should be one of the following hexadecimal
numbers, corresponding to TOS bits:
0x10 Low delay
| 0x08 High throughput
| 0x04 High reliability | | | |
Notes:
telent
is not included in Apple Mac os
forums.developer.apple.com
netcat (nc
) is a tool for connecting to random ports for testing,
Testable target demo.nats.io 4222
See Docs.NATs.io
telnetd