I have created a Study account which I use when doing anything school related work. It's purpose is to remove the distractions of my normal account, such as social media and news websites.

I know /etc/hosts can be edited to block certain domains from being accessed, but this is for all Users, and I don't want to have to switch in and out of Admin to change it every time I want to focus.

Is there any way to block these domains for specific Users or Groups?

1 Answer 1


You could use iptables to restrict the network access. The module ipt_owner enables you to match network packets by user id. A command like

iptables -A OUTPUT -m owner --uid-owner mike --dst www.google.com -j DROP

would prohibit user mike to access www.google.com.

As iptables really works with IP's instead of hostnames, this would create several rules, one for each IP of www.google.com. Downside is that you can't use iptables to limit whole domains, you would have to repeat that command for every single hostname you would like to restrict.

Be warned: If you're new to iptables you might have a hard time... ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .