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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 30 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 '15 at 1:24
What a crazy location! I just spent 20 minutes looking for this :-( – reinierpost Dec 2 '15 at 16:48

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

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.