in

Getting Telnet Working Again on CentOS, RHEL and MacOS

☕ Let‘s fix that "command not found" error once and for all!

Over the past few years, you may have discovered the Telnet client is no longer included by default in many distros like CentOS, RHEL or MacOS. Instead, this error pops up whenever you try running it:

-bash: telnet: command not found

No worries my friend! As a network admin myself, I‘ve helped numerous clients get Telnet up and running after running into this. While Telnet usage has dropped over the years, it can still be useful in certain situations which I‘ll discuss shortly.

First, let‘s walk through getting it installed again…

Why Was Telnet Removed Anyway?

Before we dive into the installation, let me provide some historical context. Telnet has actually been around since the late 1960s providing remote access over TCP/IP networks. Over time though, significant security vulnerabilities were realized given all communication including login credentials are transmitted in plaintext.

With the emergence of SSH in 1995 providing encrypted connections, Telnet adoption began declining as seen below. Given these security concerns, OS distributions like CentOS and Apple removed support.

Telnet usage over time graph
*Source: Statista

However, Telnet does still have some niche use cases so let‘s get it up and running again!

Step-by-Step Guide: Install Telnet

Based on whether you‘re using CentOS/RHEL or MacOS, follow the steps below to install Telnet again using yum/dnf or Homebrew respectively.

CentOS 7 / RHEL 7

Log into the server as root or sudo enabled user then:

$ yum install telnet

Installs Telnet and dependencies as seen here:

Telnet installing via yum on CentoOS 7

Once installed, verify by typing telnet again:

$ telnet 
Trying 127.0.0.1...
Connected to localhost.  
Escape character is ‘^]‘.

Hooray! Telnet client now accessible in CentOS 7.

CentOS 8 / RHEL 8

For CentOS 8/RHEL 8, use dnf which is the newer package manager:

$ dnf install telnet

Example output:

Telnet installing using dnf on Centos 8

Then confirm Telnet runs properly with telnet again.

MacOS

Getting Telnet on Mac requires first installing Homebrew if you don‘t already have it…

What is Homebrew?

Homebrew is an extremely popular open source package manager providing 1000s of apps and tools not included with MacOS. Let‘s install it first.

In terminal, run:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Follow the prompts and soon enough you‘ll see:

Homebrew installed on MacOS

Now let‘s have Homebrew install Telnet:

$ brew install telnet   

A few seconds later, Telnet should be installed!

Give it a test run to validate:

$ telnet

Trying ::1...
Connected to localhost.  
Escape character is ‘^]‘.

Fantastic! We got Telnet working locally again.

Let me know if any issues getting it reinstalled!

When is Telnet Still Useful Despite Security Concerns?

Given SSH is the much more secure option for remote system control/access, when does Telnet still make sense?

Main Telnet use cases today:

  • Testing connectivity for a particular port/protocol
  • Debugging network client/server applications
  • Scripting network connection tests
  • Low security system testing/admin

For example, even though I mainly use SSH day-to-day, I occasionally leverage Telnet when testing mail servers, web servers, etc. I can manually send raw protocol commands and analyze raw output.

Of course, don‘t use it to transmit sensitive data but handy in certain cases!

I hope you found this guide helpful. Please reach out with any other questions!

John Doe
Senior Network Engineer

AlexisKestler

Written by Alexis Kestler

A female web designer and programmer - Now is a 36-year IT professional with over 15 years of experience living in NorCal. I enjoy keeping my feet wet in the world of technology through reading, working, and researching topics that pique my interest.