I need to know how to fix the missing "/etc/init.d/ufw" file, is it some package or some command?
I used the gufw
to enable it, but on reboot my firewall was still off...
I created a symlink /etc/init.d/ufw -> /lib/init/upstart-job
but I could not make it work like start ufw
(neither after reboot).
I found this file /lib/ufw/ufw-init
, it looks like a init.d file! can I copy or symlink it there?
Additional (optional) questions:
How to find what package has that file? apt-cache search
didnt work..
Can we safely create such a script?
Any idea why is it missing?
Obs.:
My /etc/ufw/ufw.conf
has ENABLED=yes
(but seems useless).
iptables -L
becomes different after I ufw enable
, so ufw rules are not being applied on boot by any other means.
PS.: this script did NOT work either
sudo ln -s /lib/ufw/ufw-init /usr/sbin/ufw-init
sudo ln -s /lib/init/upstart-job /etc/init.d/ufw-init
#sudo update-rc.d -f ufw-init remove
sudo update-rc.d ufw-init defaults 99
sudo -k
I also do not have /etc/init.d/ufw and ufw was not auto starting on reboot. But I did this
On rebooting I checked with
It showed active, It always used to show inactive in previous reboots and I used to have to do
I have not installed gufw, I am beginner desktop user, so I have no idea why it worked and whether it will work for you, but it seemed simpler, may be it will help somebody.
[Check this first (I will validate it when I have time), properly configuring ufw may be the best thing to do, this answer here would then just be a fallback.]
Based on this answer and log tip from this answer, I added this:
to
/etc/rc.local
before theexit 0
and now it properly loads ufw rules on boot!But this is a user workaround and not a fix to the system...
I opted also to "change" the rules instead of applying them as default as suggest this answer, because I am not completely sure my custom rules are trouble free.
IMPORTANT: the "if" code did not work once, so I created the "while" code that til now has not caused trouble.
For the effort that went into figuring out the solution, the answer is surprisingly simple.
In /etc/init/ufw.conf:
1) Comment out lines 9 - 11
2) Insert after line 11:
start on startup
Fixes the whole problem, including logging to /var/log/ufw.log.
Note
If you have
iptables-persistent
installed, you must disable it. Moveiptables-persistent
out of /etc/init.d and rename all the symlinks inrc0.d
-rcS.d
by making the 1st letter (S or K) lower case. (Or move them out.)Maybe is your path wrong. Not
/etc/init.d/wfw
than/etc/init/ufw.conf
I have files with
ufw
in the name on the fallowing placesOutput from init file
EDIT 1
UFW is just wraper for iptables and it handles only filter table. So you can use both UFW and iptables-persistant but remove filter rules from /etc/iptables/rules.v4, and leave others if you have it (nat table, raw, etc)