How to open SSH ports on Ubuntu 16.04?

August 28, 2016 5k views
VPN Ubuntu

Hello everyone

I created a Ubuntu 16.04 droplet to configure SSH tunneling for my browser.
Here are the steps I took :
Created basic droplet ubuntu 16.04
Followed all these instructions :
Now I am trying to connect to my server through SSH with Putty on Windows.
So I followed these steps :
The problem is that I have a very strong firewall so when I configure Putty and try to connect on port 22 I get this error before being able to login :
"Software caused connection abort"

So I tried to open port 443 on my server in two different ways :

  • I did 'sudo nano /etc/ssh/ssh_config' and tried to add 443 next to Port 22 like that : # Ports 22 443
  • I also tried to open the port like that : 'sudo ufw allow 443'

I restarted my ssh server 'service ssh restart' and changed my port in Putty to 443.

Now I get that error before being able to login:
'Server Unexpectedly closed network connection'

Couple tests on my own computer :
I tried some netstat on my computer to see which ports my computer is listening to :
When I do :
'telnet host 22' I get 'Connect failed', same thing for port 443 and 80.
When I do :
'netstat -an | find ":22" I get :
as well as some 'TIME WAIT'
When I do :
'netstat -an | find ":80" I get tons of with CLOSE WAIT
When I do :
'netstat -an | find ":443" I get tons of with ESTABLISHED and TIME_WAIT

Hope these tests help. I'd like to mention I had to setup my SSH server on another computer (Macintosh) without that strong firewall.

This is for you experts, if you have any ideas to solve this please share it!
Thanks for your help

2 Answers

Thanks for your answer Ryan. I completely disabled the firewall (ufw) and it did not do anything. I even disabled AppArmor, still nothing.
Now I know it's coming from my droplet and not from my computer because i still can't connect to any other ports than 22 even on an unblocked computer...
Any of you guys ever been successful opening ports on this kind of droplets?

Before going further I would check that it's your droplet that is the problem. In order to test quickly I would recommend doing a

service ufw stop

and then see if you can reach your droplet on either 443 or 22. If you can then I would recommend resetting your ufw settings and re-configuring. If you cannot, I would recommend seeing if you can connect to other servers on port 22.

Have another answer? Share your knowledge.