Yesterday I needed to install a telnet client to finish re-configuring my wifi router (telnet turns out to be a handy tool for testing services such as mail servers – don’t use it for remote shell logins). Because general use of telnet is very insecure and frowned on by admins everywhere, this turned out to be a bit of a pain on my Gentoo installation. It didn’t look like I could install a telnet client without also installing a telnet server, which I definitely don’t need!
Thankfully, I learned that I already had a telnet client installed: GNU screen! Besides being an all-round useful tool for shell sessions, screen is easy to use as a telnet client:
# screen //telnet [host] [port]
As an example of something telnet is still useful for, suppose you needed to test the basic functionality of your mail server:
# screen //telnet mail.example.com 25 helo mail from:<eliot@example.com> rcpt to:<postmaster@example.com> data This is the body of the test e-mail. Make sure it ends with CRLF . CRLF . quit
Thanks to Google Postini for the details on SMTP sessions – I can never remember the details.
I just discovered today that some distributions do not include this capability in their builds of screen. My Gentoo system and Ubuntu 10.04LTS system both use Screen version 4.00.03 but only Gentoo’s version includes telnet capability.
If you attempt a telnet and receive this error, you’ll have to find a new way to telnet (or rebuild Screen):
Cannot exec '//telnet': No such file or directory