Where does UFW (uncomplicated firewall) save command-line rules to?

Solution 1:

In my Ubuntu 11 server, the firewall rules are saved in /lib/ufw/user.rules

Solution 2:

Ubuntu 16.04 LTS

/etc/ufw/user.rules

Debian 9

/etc/ufw/user.rules

In general, try:

locate user.rules

Should output something like:

/etc/ufw/user.rules
/usr/share/ufw/user.rules
/usr/share/ufw/user.rules.md5sum
/usr/share/ufw/iptables/user.rules

Solution 3:

I believe it's under lib/ufw/rules[6].rules


Solution 4:

In my version, 8.04 LTS Server the files are stored in /var/lib/ufw as /var/lib/ufw/user.rules and /var/lib/ufw/user6.rules.


Solution 5:

This should work on all Linux systems assuming a ".rules" suffix and residing beneath a directory named "ufw":

sudo find / -name "*.rules" -exec ls -l {} \; | grep ufw

Using the "ls -l" shows that some of them are links to others, and which ones have been updated most recently (implying they are active?)