I have a bunch of configuration in ufw that I want to avoid porting to iptables (unless there is a easy way to export from ufw and import in iptables). Simplicity of ufw etc. being the reason.

Now I want to block outgoing network for a user on the system using - How to disable internet for a user on a system

But the problem is that if I have ufw enabled, it ignores iptable rules.

How do I ask ufw to follow iptable rules as well or maybe implement that user block in ufw?


Following @aplaice's comment, I added the following line in /etc/ufw/after.rules

-A ufw-after-output -m owner --uid-owner idea -j REJECT
# don't delete the 'COMMIT' line or these rules won't be processed

You have to add it for the chain ufw-after-output and before COMMIT.

Restart ufw service after that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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