Accessing SSH When Port 22 is Blocked: Solutions and Recommendations
Introduction: Secure Shell (SSH) is a vital tool for developers and accessing platforms like GitHub. However, some networks, such as those provided by Simba Net in Uganda, often block traffic to port 22, making SSH inaccessible. This article aims to provide solutions for developers and users to overcome this limitation and regain access to SSH.
Solution 1: VPN (Free and Paid)
A Virtual Private Network (VPN) is a popular solution for bypassing port restrictions. By routing traffic through a VPN server, you can circumvent port blocking and access SSH. One recommended VPN is ProtonVPN, known for its generous free tier and wide range of countries to choose from.
Relatively easy setup process.
Allows you to access blocked sites and services.
The free tier might have slower connection speeds.
Concerns about the security and privacy of personal information.
Some VPNs may cause compatibility issues with certain websites, like GitHub.
Microsoft Edge VPN: If you use Microsoft Edge as your browser, it offers a built-in free VPN that can be activated. While this can help with broken websites, it's important to consider data consumption, especially with limited internet bundles.
Proxy: Consider using an online proxy service to access SSH and bypass port restrictions. I recommend Hide Me.
Solution 2: Changing the SSH Port on Your Server
By modifying the SSH port on your virtual machine or server, you can bypass port 22 restrictions without relying on third-party tools. Follow these steps:
Connect to your VM using your preferred method (VPN, for example).
Edit the "/etc/ssh/sshd_config" file using a text editor like Vim (commonly pre-installed in Linux distributions).
Uncomment the line "#Port 22" and change "22" to an available port of your choice.
Ensure that the new port is open in the firewall settings of your server.
Restart or reload the sshd service using the command "sudo service sshd restart" or "sudo service sshd reload".
Note: Always test the new SSH connection in a separate terminal to ensure everything is working as intended.
Solution 3: Tailscale VPN
Tailscale VPN is a user-friendly solution that leverages the Wireguard protocol. It simplifies device connectivity without requiring port openings, as it utilizes network hole punching. This eliminates the need for special permissions.
Easy setup process.
Allows unlimited connections for a single user.
Offers additional security options, such as running an exit node on one of your machines.
- May disrupt certain services like WhatsApp web and some HTTPS connections, leading to logouts.
- Tailscale has an experimental HTTPS feature option that you can use to fix the issue with WhatsApp and HTTP connections.
When faced with port 22 blocking, developers and users have several options to regain access to SSH. VPNs, changing the SSH port, and Tailscale VPN all provide viable solutions. Consider the specific requirements and limitations of each option to determine the best fit for your needs. Remember to prioritize security and privacy while exploring alternative methods.