I've installed and enabled ufw firewall, and I cannot connect to my server

6,655

ufw firewall, by default, denies any incoming connection (and allows any outgoing ones). You would have to connect your server to a display (since you cannot access remotely with the firewall), and follow these steps:

sudo ufw disable --> Now you can access your server by ssh if you prefer

sudo ufw allow from <specific ip/subnet> to any port <port number>

Let's suppose you want to access the server from anywhere in your local network:

sudo ufw allow from 192.168.1.0/24 to any port 22

For the web server, we'd have to do something similar:

sudo ufw allow from any to any port 80

Share:
6,655

Related videos on Youtube

Julen
Author by

Julen

Updated on September 18, 2022

Comments

  • Julen
    Julen over 1 year

    I've installed ufw firewall on my little server, with ssh and web services. But, when enabled, the ssh connection lost, and I could neither connect to the hosted web via web browser.

    What has happened?

    • Jenny D
      Jenny D over 8 years
      At a guess, you did something wrong. Since you've not included the config, it's impossible to point out what you should fix. Thus, my only advice is "find what you did wrong and try doing it right instead".
  • Paul
    Paul over 8 years
    This solution will only work those with either a tty emulator or physical access to the device. Other scenarios may require completely different solutions, such as saving an image, adding to a storage container, and accessing it from a different server.