UFW blocked SSH: how to get back into the server
If the server stopped accepting SSH after ufw was turned on, you can get back in through the console in the panel. The system stays as it was, no reinstall is needed.
Why access was lost
ufw enable run without allowing port 22 closes every incoming connection. Your current session may still work, but a new SSH connection will not get through.
How to get back in
- Open the server's page in the panel.
- Press Console, then Open the console.
- Sign in as root with the password from the panel.
- Run one of the commands below.
- Try to connect over SSH from your computer.
The console link lives for a few minutes. If it has expired, open the console again.
Which command to pick
To keep the firewall on with SSH working:
ufw allow 22/tcp && ufw enableIf you do not need the firewall yet, turn it off:
ufw disableIf your SSH runs on another port, allow that port instead of 22.
How to turn ufw on the right way
The order matters: allow SSH first, then turn the firewall on.
ufw allow 22/tcpufw enableufw status
In the output of ufw status check that the SSH port is in the allowed list. Only then close your current session.
Questions
Do I have to reinstall the system if ufw closed SSH?
No. Sign in through the console in the panel and change the ufw rules.
Which password does the console take?
Sign in as root with the password from the panel.
The console link stopped working. What now?
It lives for a few minutes. Press Console, then Open the console on the server's page again.
More in the help
- How to connect to a server over SSH, step by step
- How to reinstall the system on a server
- An XFCE desktop on an Ubuntu server over RDP
- How to add an extra IP address to a server
- Signing in and protecting your account: e-mail, Google, Telegram, a code
- One-click apps: how to install one on a server
- Traffic and speed: what a plan includes
- Payment, renewal and auto-renewal of a server
- Which server to choose for your task
- Why a service shows another country for the server
- How to move to a higher plan and carry your data over
- Windows Server 2022 on a server: plans and connecting
- How to make a Minecraft server to play with friends
- How to put mods on a Minecraft server: Forge and Fabric
- How to make your own CS2 server to play with friends
- How to run a Telegram bot on a server so that it works 24/7
- How to put n8n on your own server: no limits on runs
- PIRS partner programme: 20 % of payments, with no end date