Another SSH tunneling trick - to get you ssh into your blocked server from the outside world

I wrote a blog post about SSH tunneling 4 years ago at this. Today I will show you another trick that gets you into the server behind firewalls.

Normally, corporate's firewalls will block all the incoming ports except port 80 and 443 which are using for accessing the web servers. So, here are how to can get access to the servers from outside (assuming you have access to the server you want to connect to from inside the corporate network):

1. If the server you want to connect to doesn't have anything web or anything running on port 80/443, you just need to change its's ssh config to let sshd runs on port 80/443.

sudo nano /etc/ssh/sshd_config

Port 80
sudo systemctl restart ssh

2. If your server already has a web or a server that runs on port 80/443, use another server that you can access from inside the network and free of port 80/443. 

Then establish the tunnel, assuming:

  • the server that I have access from inside the network
  • the server that I want to connect to from outside (I also have access to this server from inside)
  • 80: the port I want to open on
  • 22: ssh port of
  • serverAuser: a user on
  • serverBuser: a user on

a. Run this command on

sudo ssh -L

b. From a computer outside the corporate network run this command to ssh to

ssh -p 80