I have installed UFW on my VPS server using apt install ufw when I use ufw enable to start the firewall, after that my putty session expires and I can no longer login with that ssh key I have either change ssh key or disable firewall or delete my entire OS and re-install it. I have checked and sure that when I start UFW firewall I cannot connect with ssh key to my vps.
- Firewall = UFW firewall
- Start Command =
ufw enable - Error reason = ufw firewall preventing connection with ssh key using putty or any other terminal
- Error Output =
ssh: connect to host <VPS_IP> port <VPS_PORT> : Connection timed out - OS used in VPS =
Ubuntu 20.04
ufwyou will want to ensure OpenSSH is permitted through. You can do so like this:sudo ufw allow in "OpenSSH". Without this, you block port 22 from receiving connections – matigo Feb 22 '22 at 11:29