I want that one of the users (not in the sudoers list) have Internet access from 14:00 until 16:00 and from 17:00 until 18:30. Is it possible? Can I set different time intervals for different week days?
You can use iptables's
Now you can use cron to add or remove those rules (which may need a little bit of shell scripting if you already have some iptable rules or want it to to for different users at different times).
0_ login as root:
1_ check the status of your firewall:
if the firewall is inactive, issue:
2_ in order to restrict user wilhelm internet access on Sundays, Tuesdays,Wednesdays and Fridays to the allowed time intervals (14:00-16:00 & 17:00-18:30) :
side note: *please note the use of
3_ please make sure that the rules were indeed properly entered:
in order to delete an inappropriate rule, say rule No. 1, (1-based count from top of iptables -v -L OUTPUT) issue: iptables -D OUTPUT 1.
4_ save iptables for restoring on the next boot:
tested on Ubuntu 11.10 (oneiric), locale: he