Unix How-To: When Telnet isn't Telnet

By  

The security dudes have been badmouthing telnet for a couple of decades now, reminding us that this old time tool for connecting to remote systems exposes our passwords to the snooping masses. But the telnet command itself still has some handy uses that shouldn't be abandoned.

Telnet is, first and foremost, a tool for creating a terminal-like login session on a remote system. As such, it does just what the security dudes have been warning us about -- it sends your login information across the network in clear text. Given that, anyone running snoop, tcpdump, wireshark (nee ethereal) or any other packet grabber can steal and use your credentials. In short, that's a bad thing.

Telnet for connecting to a service that doesn't use encryption, on the other hand, is a friendly and useful tool. Want to check whether a web site that you manage is running from the command line? No problem, try "telnet remhost 80" and you will connect to the web service. Once connected, you can issue a "GET /" command and grab the home page. If you don't mind reading a little HTML (which is good for our little dweebish souls now and then), you'll get a nice confirmation that the web site is up and doing the right thing.

You can also test a mail server using telnet by aiming the tool at port 25. In fact, if you like, you can send out a test message by speaking the "sendmail lingo", otherwise known as the SMTP protocol. The conversation goes through greeting the remote system (after it acknowledges the connection) by saying something like "HELO myname" and then piecing your message together using "MAIL FROM: myserver@mydomain.com", "RCPT TO: recip@recipdomain.org", "DATA", your text message, a "." on a line by itself to end the message and, finally, a "quit" to exit.

220  mailserver.domain.com  someorg ESMTP MAIL Service, Version: 1.2.3.4
helo myserver.domain.com
250 mailserver.domain.com Hello [10.2.3.4]
mail from:
250 2.1.0 myname@mydomain.com....Sender OK
rcpt to:
250 2.1.5 recip@recipdomain.org
data
354 Start mail input; end with <CRLF>.<CRLF>
subject: Testing 1 2 3
This is a test.  You may ignore it.
.
250 2.6.0  Queued mail for delivery
quit

You can use telnet to test a range of applications, though not every application will cooperate with telnet's communications. Try it with POP3, MS Exchange and numerous text-based applications. It can be a useful tool for checking whether a service is not just running, but responding properly.

Yes, you will still be sending information in plain text, but for many applications (such as web servers), that's par for the course. When you use telnet to test a service in this way, you're not talking with a telnet daemon, but only using the telnet command to make the connection for you to connect to the service if your choice.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question
randomness