sudo ufw status return 'inactive'

Posted March 27, 2018 356k views
NginxUbuntu 16.04

Trying to set up Nginx in Ubuntu 16.04 following the tutorial given in everyhting is fine but running the command

sudo ufw status

gives inactive.

What is wrong?

Thank you

1 comment
  • After “sudo ufw default deny”, I could no longer ssh into my droplet. I went to the Digitalocean console, logged in, and entered “sudo ufw default allow”. Now I can ssh into my droplet again.

    Now “ufw status” returns “Status: active” along with some other information. Go figure.

    Thanks BuyDeal. You had me worried, but all’s well that ends well.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
8 answers
sudo ufw enable
sudo ufw default deny

And I then do:

sudo iptables -L

Not Sure…

All I needed was:

$ sudo ufw enable

I then got the following prompt:

Command may disrupt existing ssh connections. Proceed with operation (y|n)?

After hitting “y” I saw:

Firewall is active and enabled on system startup

And sudo ufw status gave me the expected output.

Well this might be quite old to reply but do remember to add sudo ufw allow 22/tcp otherwise you will not be able to do ssh into your vm once you exit out of it.

$ sudo ufw enable
$sudo ufw status 

now ur status will change to active

sudo ufw enable
sudo ufw status

eso funciono para mi

Alternatively instead set up everything you can just use Ubuntu image with LEMP: droplets> destroy> rebuild> choose Ubuntu LEMP > REBUILD

However I face problem that UFW firewall NOT WORKING AT ALL for ubuntu images 16 (with docker) and 17 :

If you found some solution can you test that UFW really works in your case and give me some info?

Alternative2> Instead of UFW you can use Network Firewall accesed by diitalocean web panel

thank you all that worked for me!!

após realizar o procedimento não estou conseguindo me conectar ao ssh, como posso resolver isso?

recebo este erro: ssh: connect to host port 28588: Connection refused