I often travel for work, and a few times happened I wasn’t able to access my VPS via SSH on a working internet connection. So I wrote this article to help me remember how to ssh everywhere.

SSH Behind Firewall

In my case, I was not able to use ssh because of a firewall on the guest WIFI network that was blocking port 22.

To use ssh, I did the following: login to my VPS server, and change the port where SSH is running.

Below is the procedure I followed. In my case, I am working on a Mac laptop and my VPS is on VirtualHost.

Verify you can use port 443

Use GitHub server to verify that you are able to connect to their port 443. If this works, you can proceed and set up ssh on your server on port 443. Otherwise, you need a different solution, like a VPN.

Access via Remote Login

DigitalOcean offers a remote console service, that I can use to change on the fly the port on which SSH is running.

Edit sshd_config

nano /etc/ssh/sshd_config

Uncomment the line #Port 22 and transform it into Port 443.

Save the file and restart the ssh service

sudo systemctl restart ssh

You can now ssh -p 443 to your server.

ssh -T -p 443 myuser@234.345.322.20

References


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *