What is Telnet Command |Telnet Command Examples

Telnet Command :

In my previous article, I have explained about Ping command in UNIX with examples as well as some important examples of FTP command. In this article, I will try to give you the idea of telnet command with its important usages. Telnet is a protocol, which is used on internet or Local Area Networks (LAN) to connect with UNIX remote machine. Lot of times when user needs to connect with the remote UNIX terminal through network. Telnet utility is one of the important utility, which is used to connect with remote machine and work on that machine remotely.

TELNET command is used to communicate with another host with using TELNET protocol.

Just like the FTP command if telnet enters in to its command mode. The prompt of telnet is

telnet> which has list of options.

Telnet > Command Options:

Example 1 : Connecting to the telnet server :

The basic question is how the user will connect with telnet. User can connect with the Telnet by using the hostname or ip of the host.

Syntax 1 :

$telnet Hostname/Ip Address

Example :

$telnet 10.20.208.110

Telnet>

It will directly connect with telnet server.The telnet command internally executes the open command without any option.

Syntax 2: Without using Hostname or Ip Address

Example:

$telnet

telnet>Open hostname/ipaddress

If user don’t want to use any arguments with telnet command then just type the telnet command and connect with Open command with specific remote host.

Example 2 : Attempt to Open connection to remote host

Telnet command is used to open the connection to the remote host.If connection is established then host will prompt for log in name and password.

$telnet www.yahoo.com

Trying…

Connected to www.yahoo.com

Escape character is ‘^]’.

login: Amiets

Amiets’s Password: ssssara

*****************************************************

*                                                   *

*                                                   *

*    WELCOME TO Yahoo.COM                          *

*                                                   *

*                                                   *

*****************************************************

Last unsuccessful login: Fri OCT  13 10:01:09 IST 2018

Last login: Wed OCT  13 18:33:27 IST 2018 on pts/10

{  do your work }

$ logout

Connection closed.

C:>

Example 3 : Check telnet support commands for particular user

Telnet Command

Just like the FTP command Help command or ? is used to show the specified telnet support commands for the specific user.

$telnet help

This command will show you the different supporting commands of telnet user.

Example 4 : Checking and changing Telnet Configuration

User can check and change the telnet configuration.User needs to use the vi editor to open the telnet file.

Command used to open the telnet configuration :

vim /etc/xinetd.d/telnet

Output :

service telnet

{

flags          = REUSE

socket_type    = stream

wait           = no

user           = root

server         = /usr/sbin/in.telnetd

log_on_failure += USERID

disable        = no

}

These are above some important Telnet Examples. Let us check the different options of Telnet command.

Example 5 :How to use display command here?

telnet> display

Example 6 :How to use telnet mode?

telnet> mode

Options of Telnet Command :

-4 Force IPv4 address resolution.
-6 Force IPv6 address resolution.
-8 Request 8-bit operation. This causes an attempt to negotiate the TELNET BINARY option for both input and output. By default telnet is not “8-bit clean” (it does not recognize 8-bit character encodings such as Unicode).
-E Disables the escape character functionality; that is, sets the escape character to “no character”.
-L Specifies an 8-bit data path on output. This causes the TELNET BINARY option to be negotiated on just output.
-a Attempt automatic login. Currently, this sends the username via the USER variable of the ENVIRON option if supported by the remote system. The username is retrieved via the getlogin system call.
-b address Use bind on the local socket to bind it to a specific local address.
-d Sets the initial value of the debug toggle to TRUE.
-r Emulate rlogin. In this mode, the default escape character is a tilde. Also, the interpretation of the escape character is changed: an escape character followed by a dot causes telnet to disconnect from the remote host. A ^Z (Control-Z) instead of a dot suspends telnet, and a ^] (Control-Close Bracket, the default telnet escape character) generates a normal telnet prompt. These codes are accepted only at the beginning of a line.
-S tos Sets the IP type-of-service (TOS) option for the telnet connection to the value tos.
-e escapechar Sets the escape character to escapechar. If no character is supplied, no escape character will be used. Entering the escape character while connected causes telnet to drop to command mode.
-l user Specify user as the user to log in as on the remote system. By sending the specified name as the USER environment variable, so it requires that the remote system support the TELNET ENVIRON option. This option implies the -a option, and may also be used with the open command.
-n tracefile Opens tracefile for recording trace information. See the set tracefile command below.
host Specifies a host to contact over the network.
port Specifies a port number or service name to contact. If not specified, the telnet port (23) is used.

TELNET SERVER IS INSECURE

Telnet is used to remote login. The login name and password are in clear text format while logging. so if some one is tracing our connection using wireshark like tools, then he/she can easily see your data along with your login id and password.And even a remote user can easily find that your telnet port is on or not by just using simple nmap command

Example :

[root@localhost test]# nmap 192.168.1.1

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-04-24 01:27 EDT

Interesting ports on 192.168.1.1:

Not shown: 1673 closed ports

PORT      STATE SERVICE

23/tcp    open  telnet

79/tcp    open  finger

111/tcp   open  rpcbind

Nmap finished: 1 IP address (1 host up) scanned in 0.463 seconds

Hence one can clearly see that port for telnet is open.so now he or she can attempt to have a remote login on this machine and to get remote login username and password he/she can use wireshark.

Hope this article will helpful to everyone who needs to know about the telnet command.