Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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... ;)

share|improve this answer
add comment

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.