Skip to content

Instantly share code, notes, and snippets.

@funkjedi
Created July 11, 2017 18:40
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funkjedi/88c31179d455b9c6edb2b31b9564ede1 to your computer and use it in GitHub Desktop.
Save funkjedi/88c31179d455b9c6edb2b31b9564ede1 to your computer and use it in GitHub Desktop.
Remove UFW chains
#!/bin/bash
for ufw in `iptables -L | grep 'Chain ufw' | awk '{ print $2 }'`; do iptables -F $ufw; done
for ufw in `iptables -L | grep 'Chain ufw' | awk '{ print $2 }'`; do
iptables -D INPUT -j $ufw
iptables -D FORWARD -j $ufw
iptables -D OUTPUT -j $ufw
done
for ufw in `iptables -L | grep 'Chain ufw' | awk '{ print $2 }'`; do iptables -X $ufw; done
@dukejunior
Copy link

Thanks. Helped me, cause I wanted to clean up.

@iongradea
Copy link

Helped me a lot ! Thx mate !

@conandrum
Copy link

If you delete some rules e.g. iptables -D INPUT -j $ufw
how do I get UFW to remember the changes on reboot? What command do I send to UFW?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment