Accessing Your VPS via SSH on Networks That Block Port 22

Accessing Your VPS via SSH on Networks That Block Port 22

Some internal or guest networks, such as corporate WiFi or public hotspots, only allow outbound connections on ports 80 and 443. Since SSH normally runs on port 22, your connection will fail unless you make your VPS listen on one of the allowed ports. The simplest way to solve this is to configure your VPS provider of choice to expose SSH on port 80 or 443.

Here is a clear walkthrough using any typical Linux VPS:

1. Deploy a small VPS

Pick any VPS provider. A lightweight instance is enough because SSH traffic is mostly text. Create the server with your preferred Linux distribution.

During deployment, make sure you enable inbound rules for port 80 or 443 in the provider’s firewall options.

Optionally assign a static public IP so you don’t need to look it up each time.

2. Log into the VPS and update SSH configuration

Connect to your VPS normally (from a network that permits port 22) and edit the SSH daemon config:

sudo nano /etc/ssh/sshd_config

Change the port line:

Port 80

Or, if you want both ports open:

Port 22
Port 80

Save and exit.

3. Update SELinux (only needed on SELinux-enabled systems like CentOS, AlmaLinux, Rocky)

sudo su
semanage port -m -t ssh_port_t -p tcp 80
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --reload
systemctl restart sshd.service

4. Verify that SSH is listening on the new port

ss -tnlp | grep ssh

You should see entries indicating sshd is bound to port 80 or 443.

5. Connect from the restricted network

Once SSH is running on an allowed port, you can log in even from a network that blocks everything except web traffic:

ssh your.vps.ip -p80

This bypass works because to the restrictive network, your SSH traffic looks like a normal outbound connection to port 80 or 443.