telnet: command not found – cPanel server

telnet is a command line utility that can be used to test the connectivity with the remote host on a specific port. By default telnet may not be installed on your server and you may receive “telnet: command not found – cPanel server” error while executing the telnet command.

[root@server ~]# telnet google.com 443
bash: telnet: command not found

The procedure to install telnet package can be vary depending on your server’s operating system. Following are the commands for the different operating systems to install telnet package.

Ubuntu

apt install telnet

CentOS 7

yum install telnet

AlmaLinux 8 or CentOS 8

dnf install telnet

Once the telnet package is installed successfully, you can test using the following command:

[root@server ~]# telnet host.example.tld 25
Connected to host.example.tld.
Escape character is '^]'.
220-host.example.tld ESMTP Exim 4.95 #2 Wed, 11 Jan 2023 12:40:54 +0000
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.

If it is connected successfully, you will get output or it may give you prompt depending on the service output. Above is an example output on Port 25 for Exim server.

If the connection is blocked, you will get either a connection refused or a timeout.

[root@server ~]# telnet example.tld 25
telnet: connect to address 192.168.1.1: Connection refused
[root@server ~]# telnet host.example.tld 25
telnet example.tld 25
telnet: connect to address 192.168.1.1: Connection timed out

To exit a telnet session, use the CTRL+] keyboard combination, hit enter, then type close and hit enter again.

For more tutorial related web hosting, you can refer our web hosting knowledge base section.

cPanel cPanel Guides Web Hosting Discussion