I have a machine running Windows 7 and I want to connect to it from Ubuntu.

Until now it was working just fine.

But now, when I try to connect to Windows 7 from Ubuntu, I get this:

telnet: Unable to connect to remote host: Connection refused  

I opened port 23 in Windows following these instructions.

I have also enabled the Telnet client and Telnet Server from Windows Features.

I am sure port 23 from Ubuntu is LISTENING.

What else can I try?

  • Have you checked the setup with nmap? nmap.org – OddDev Jul 28 '15 at 11:36
  • i have it on my ubuntu but not on my windows 7.What is it used for? – Fatemeh Rahimi Jul 28 '15 at 18:51
  • You are able to ensure that the ports are open as they should be. You can kind of "ping" (of course it's actually not a ping) on different ports. – OddDev Jul 29 '15 at 6:03

I'm quite unsure if it is a good idea to help you?! But I will help. I'll show you how to set it up both ways.

A small notice up front. Telnet is quite old, has no encryption and is a guaranteed invite for a hacker. So if you can avoid using telnet, please do so!

1. Connect from Windows to Ubuntu with telnet

Telnet server won't work by default because it is insecure and therefore not installed by default. To do so, do the following:

sudo apt-get install xinetd telnetd

This will install the telnet server. After the install you should be able to connect to your ubuntu server from windows.

2. Connect from Ubuntu to Windows

To connect the other way, you need to have the telnet client installed on Ubuntu. As telnet is considered insecure, the telnet client also is not installed by default.

apt-get install telnet

After that you should be able to connect with the telnet command from the console.

telnet your-server.here

3. Troubleshoot connection

If this doesn't work you will have to troubleshoot your connection.

Make sure Ubuntu isn't stopped by a firewall

Just check if the Ubuntu firewall is enabled

sudo ufw status

and disable it for the time being, if it is on

sudo ufw stop

and you should probably allow the tcp port

sudo ufw allow 23/tcp

Use nmap to test if the windows telnet service is available

sudo nmap -sS your-server.here

If you can't see the port listed after the scan, the problem is with your windows machine.

  • Good answer. Two things, please show how to use nmap specifically for this use case, and as a side note, busybox telnet will give you a good enough client in most cases, and is already installed. – user595510 Aug 15 '17 at 10:39
  • Yo Mark I did, BUT somehow I can't seem to get it into the code block, IDK why? My answer is there, take a look.... sudo nmap -sS your-server.here – s1mmel Aug 15 '17 at 12:44
  • I see it now. I made a small edit. – user595510 Aug 18 '17 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.