I have a problem with Ubuntu 14.04. I am a student of microcomputer systems and networks.

I have a virtual machine running Ubuntu 14.04 and when trying to connect to localhost with telnet, the following happens:

$ telnet localhost
Connection closed with foreign host 
  • You should show the exact command that you are using to make the connection. Also mention what you expect to happen. Is there or should there be anything listening for a telnet connection on the port that you connect to? – Kusalananda Jun 7 '18 at 10:00
  • Use 'telnet localhost', i hope to start sessión in telnet. – Mireia Jun 7 '18 at 10:10
  • 3
    Do you have a Telnet server installed? (Most modern operating systems do not install Telnet servers by default.) – AlexP Jun 7 '18 at 10:14
  • telnet localhost will connect you your local system on port 23 by default unless you mentioned port no., like telnet localhost 22 – erTugRul Jun 7 '18 at 10:14
  • 1
    Yes, i have instaled Telnet and the port used for Telnet is 23. – Mireia Jun 7 '18 at 10:22

Open port no. 23 on ufw by giving below command :

sudo ufw allow 23

If ufw is not installed then first install it by issuing below command and then try again the above command :

sudo apt-get install ufw

Now, you can connect with telnet localhost

  • I do what you say and nothing :( – Mireia Jun 7 '18 at 10:53
  • cal you telnet localhost 22? – erTugRul Jun 7 '18 at 10:55
  • 1
    It is rare for firewalls to block local connections to localhost. – Kusalananda Jun 7 '18 at 10:55
  • @Mireia are you getting Protocal mismatch before connection closed by foreign host? – erTugRul Jun 7 '18 at 10:57
  • that means you are getting connected, once you will type something after that, it will give 'Protocol Mismatch' and pressing Enter key several time will give 'Connection closed by foreign host'. This is actually not a problem. It works like that. – erTugRul Jun 7 '18 at 11:25

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.