Home » Questions » Computers [ Ask a new question ]

UFW as an active service on Ubuntu

UFW as an active service on Ubuntu

How can I setup ufw so it is activated when I turn on my computer, and protects all accounts?

Asked by: Guest | Views: 282
Total answers/comments: 1
Guest [Entry]

"The UncomplicatedFirewall docs and a related UbuntuForums post suggest sudo ufw enable is all you need to do for UFW settings to persist across reboots.

But you indicate that running sudo ufw status after doing an enable still shows the firewall as disabled. ... If true, this indicates something is broken.

Does it help if you run /etc/init.d/ufw start (or restart)? Have you tried installing the gufw GUI (via Synaptic or other package manager) and configuring with that?

Please edit your question and include the content of /etc/default/ufw and /etc/ufw/ufw.conf.

Update:

OK. Running the init script works, so it appears the service isn't getting started at boot-up properly. It's hard to say exactly why, but I'd bet some inconsistency between Jaunty and Karmic that got confused during the dist-upgrade.

Use update-rc.d (more info) to create the startup links in the right place:

sudo update-rc.d ufw defaults

Then verify that the startup script links have been created:

ls -l /etc/rc?.d/*ufw

-- you should get a list of symbolic links like this (or very similar -- the numbers in the link name could be different):

lrwxrwxrwx 1 root root 17 2009-10-06 22:33 /etc/rc1.d/K01ufw -> ../init.d/ufw
lrwxrwxrwx 1 root root 17 2009-10-06 22:33 /etc/rc2.d/S99ufw -> ../init.d/ufw
lrwxrwxrwx 1 root root 17 2009-10-06 22:33 /etc/rc3.d/S99ufw -> ../init.d/ufw
lrwxrwxrwx 1 root root 17 2009-10-06 22:33 /etc/rc4.d/S99ufw -> ../init.d/ufw
lrwxrwxrwx 1 root root 17 2009-10-06 22:33 /etc/rc5.d/S99ufw -> ../init.d/ufw

If those are in place, your firewall should get started automatically next time you reboot.

Update 2: I updated the update-rc.d line above; the old should work but I think this version is a bit more ""proper"". The old probably won't create the K01ufw links."