Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can i block facebook for particular time intervals in Ubuntu server?

Can anyone help me.

share|improve this question
Pull the cable off? What is it exactly you want to block? – Calimo Mar 13 '14 at 9:53

If you like to do it command line:

sudo iptables -A OUTPUT -p tcp --dport 80 -d ipaddress_here -m time --timestart 09:00 --timeend 22:00 -j ACCEPT
sudo iptables -A OUTPUT -p tcp --dport 80 -d ipaddress_here -j REJECT

Those are two rules for your iptable allow to use port 80 for specificIP in a specific time and reject in other times.

All you have is to replace the ip-address of facebook letus say and put the timestart and timeend

But this is great IF you know the IP's.

For that I provide you other ways:

If you use Google Chrome, I strongly recommend the StayFocusd extension. It takes a second to install and 30 seconds to configure the options - choose how much time you want to allow yourself to be on Facebook and other sites that you class as time-wasting.

If you're a Firefox user, consider LeechBlock.

share|improve this answer

Your Answer


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.