formats

How to Manually Edit ufw Rules on Ubuntu Linux



ufw is the great command line app for managing iptables in Ubuntu. While any changes should use the ufw command, it is possible to rather manually edit user created ufw rules in cases where that might be desirable.



The file location is:


/lib/ufw/user.rules



For ipv6 rules, the file is:


/lib/ufw/user6.rules





As with iptables, rules are processed in the order of the file top to bottom. For example this first rule would be processed before the one following:


### tuple ### deny any any 0.0.0.0/0 any 192.168.1.1 in
-A ufw-user-input -s 192.168.1.1 -j DROP


### tuple ### allow any 80 0.0.0.0/0 any 0.0.0.0/0 in
-A ufw-user-input -p tcp --dport 80 -j ACCEPT




After making changes, restart ufw:

$ sudo service ufw restart


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Home linux How to Manually Edit ufw Rules on Ubuntu Linux