Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

You add a rule like this:

ufw allow 22/tcp

The rule is saved, and is applied even after reboot. But it's not written anywhere in /etc/ufw. Where is it saved to? (Ubuntu, using ufw as pre-installed.)

share|improve this question

4 Answers 4

up vote 23 down vote accepted

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

share|improve this answer
Bingo, thanks. There's also a user6.rules (which doesn't have all the rules I created, but otherwise looks similar). – Steve Bennett Feb 13 '13 at 8:20
user6.rules is for IP version 6 (ipv6) firewall rules. – Daniel t. Feb 13 '13 at 14:41
Oh of course, thanks. – Steve Bennett Feb 15 '13 at 0:44
Still correct in Ubuntu 14, thank you. – Nick Triantafillou Aug 27 at 1:24

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

share|improve this answer

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.

share|improve this answer

In Mint 17 I found this in /lib/ufw not /usr/lib/ufw all the IPtabled version rules are here and allow me to edit them as I desire.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.