I have been trying to connect using telnet. I keep on getting Connection refused.

After checking ports listening, I observed the port is listening to the localhost IP but I wanted it to listen to any IP. So how do I detach it from the localhost and make any?

  • I want to replace this with the
  • I have disabled both firewall and still have it that way

Please, how do I fix this?

  • 1
    "the port is listening to the localhost IP" makes no sense. What software is listening to port xxxx (why is that hidden?) on - perhaps you need to configure that telnet daemon? also, why have you tagged ssh if you want telnet? Commented Feb 26, 2023 at 6:51
  • What service is running on the xxxx? If it's telnetd, then why are you running an obsolete and network-insecure login service? Commented Feb 26, 2023 at 8:08
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Feb 26, 2023 at 9:47

1 Answer 1


The likely reasons are that telnetd service isn't available in the target, or firewall or other security measure is blocking the access.

Telnet is an inherently insecure protocol. telnetd isn't included in the modern systems at all by default. When telnetd isn't running, telnet localhost results in

pg1@TREX:~$ telnet localhost
Trying ::1...
telnet: Unable to connect to remote host: Cannot assign requested address

When connecting to a remote server with no telnetd running, telnet <serverIP> results in

pg1@TREX:~$ telnet
telnet: Unable to connect to remote host: Connection refused

So if you explicitly need to use telnet you first need to install and run telnetd service.

Due to it's insecurity usage of Telnet is not recommended. The industry standard CLI connection method is SSH (Secure SHell). SSH client is included with every Linux distribution. SSH server might not be, but OpenSSH server is available in the distribution repos. There are also other alternatives, like the lightweight Dropbear. However before diving into alternatives one should learn the standard SSH first.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .