I've removed ufw and I want to get rid of all the chains it leaves behind. How can I do that easily?

share|improve this question

This two liner run as root will quickly find all the names and run them through a for loop that runs iptables -F to flush references to the chain then iptables -X to delete them.

for ufw in `iptables -L |grep ufw|awk '{ print $2 }'`; do iptables -F $ufw; done
for ufw in `iptables -L |grep ufw|awk '{ print $2 }'`; do iptables -X $ufw; done
share|improve this answer
1  
I deleted my answer as it upset askubuntu.com/users/181795/yugi but I thought I'd add here, if you're not running this as root, you'll need add sudo to both iptables calls. – Adam K Dean Dec 4 '17 at 10:51

Your Answer

 
discard

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.