skip to content
Ruban Selvarajah

Unblock incoming SSH connections to an Ubuntu server

/ 1 min read

Not that common with key-based authentications being the norm but it does happen from time to time when working with test servers.

Let’s 🚀

Check if your IP is banned

1. Access the root terminal

  • If you’re using GCE, you can use Cloud Shell
  • For other providers, there’s usually a way to access the root terminal through the dashboard

2. Print the firewall rules

Terminal window
sudo iptables -n -L

You should see something like this:

Chain f2b-sshd (1 references)
target prot opt source destination
REJECT all -- 165.140.153.138 0.0.0.0/0 reject-with icmp-port-unreachable

where 165.140.153.138 is the banned IP

Unban the IP

Terminal window
sudo fail2ban-client unban 165.140.153.138

You should now be able to connect using your local terminal again.