How to Block Facebook

Nov 21, 2010 - 32 Comments

block facebook Facebook is a great way to stay connected to people and has plenty of benefits, but that’s not why we’re here, we’re here to block access to Facebook. Why? Well, there are many reasons to block the site, companies often block the site to prevent employees from accessing it on company time, and parents may want to block Facebook to keep their young children away from some of the more mature content.

Then there are people like me, you like the site but you find Facebook to be an enormous distraction when trying to be productive. Sometimes the easiest way to eliminate the distraction is by forcibly blocking a site along with others that are blackholes of time. I actually have Facebook and a handful of other sites permanently blocked on my work machine, it has kept me free from distractions and I’m sure it helps my productivity. Without further ado, let’s find out five different ways to block Facebook.

5 Ways to Block Facebook

You’ve decided you want to block Facebook, we’ll cover various ways to achieve this. This will include specific methods for Mac and Windows, and also ways to block Facebook from an entire network using a router or custom DNS. Before you ask, yes these methods work for blocking other websites and domains as well.

Block Facebook system-wide using the Hosts file

By editing the hosts file, you will block Facebook (or other specified websites) from all applications on that computer. This is actually the method I use when I’m trying to block a website because it’s so easily reversible and it’s system-wide.

How to block Facebook with the Hosts file in Mac OS X:
This works in all versions of Mac OS X.

  • Launch the Terminal, located in /Applications/Utilities/
  • At the command line, type: sudo open /etc/hosts
  • Enter your administrative password when asked
  • TextEdit will now launch with /etc/hosts open, you need to add the following lines to the bottom of the file

127.0.0.1 facebook.com
127.0.0.1 login.facebook.com
127.0.0.1 www.facebook.com

  • Each one of those entries must be on it’s own line. Save the file when it’s finished editing
  • Now you need to flush the DNS cache for changes to take effect, type the following command in the Terminal: dscacheutil -flushcache
  • Try to access facebook, it should no longer work

If you remove the entires from the /etc/hosts file you will be able to access Facebook again as usual.

How to block Facebook with the Hosts file in Windows:
This works for Windows XP, Windows Vista, and Windows 7.

  • Locate your Windows hosts file, at C:\WINDOWS\system32\drivers\etc\hosts
  • Open this file in your favorite text editor, Notepad works fine
  • Add the following lines to the hosts file:

127.0.0.1 facebook.com
127.0.0.1 login.facebook.com
127.0.0.1 www.facebook.com

  • Reboot your Windows PC and try to access Facebook, it should be blocked

You can then unblock Facebook by simply removing the entries from the hosts file.

Blocking Facebook with Internet Explorer

If you’re trying to block Facebook from a PC and the primary browser is Internet Explorer, you can add it to a built-in block list:

  • Open Internet Explorer and click on the ‘Tools’ menu
  • Click ‘Internet Options’
  • Click on the ‘Content’ tab
  • Click the ‘Enable’ button
  • Click on the ‘Approved Sites’ tab
  • Type www.facebook.com in the box
  • Click ‘Never’ and then click ‘OK’
  • You’ll be asked to enter and confirm a password, do this and don’t forget the password
  • Now click on the ‘General’ tab and select ‘Users can see websites that have no ratings’
  • Click OK

You can do the same type of browser blocking with Safari, Chrome, and Firefox, but this is really the worst method since you can get around it so easily by just using another browser.

Temporarily blocking Facebook and other sites with SelfControl

If some of this is overkill to you, another solution for Mac users is to use an app called SelfControl which blocks distracting websites on your machine for a set amount of time. It includes a fully customizable blacklist so you can add and remove any site that is wasting your time quite easily.

Blocking Facebook from being accessed by an entire network

Perhaps you’re an office or school and you want to prevent your employees and students from accessing Facebook from your network. I know of several companies that do this for security reasons, and others block sites that they feel are not related to the task you should be performing. The easiest way to block sites is at the router, firewall, or DNS level. The other advantage to this method is that it should prevent someone from accessing Facebook from even an iPhone or Android phone, assuming it is connected through the wireless network.

Blocking Facebook on the Router

If you want to have a network-wide block of Facebook, all you need to do is add it to the block list on your router. I’ve seen this done countless times at offices, coffee shops, libraries, schools, and it’s one of the easiest ways to block everyone from accessing the site. The ability to block sites is usually labeled something along the lines of “Internet Access Policy” or “Domain Management” so you’ll have to look around in your router settings for the option. After you find it, it’s just a matter of adding the domains and saving the changes to the router, which will effect all machines that connect to the internet from that access point.

Block Facebook with OpenDNS

Using OpenDNS you can block Facebook or any other domains by adding them to a custom block list. Here’s the process for OpenDNS:

  • Add a network to your OpenDNS account via the account Dashboard
  • Navigate to “Settings” and select the network you want to block the site on
  • Select “Manage Individual Domains”
  • Select “Always Block” and then type in the domain you want to block (in this example, facebook.com)

This will effect all computers that are using the OpenDNS account to access the internet, if you have this set on a router, it will effect all the machines that connect to that router. Changes to OpenDNS are generally pretty quick, but it may take up to 15 minutes. You’ll also need to flush the DNS cache or reboot each machine that connects to the network for the changes to take effect, for this reason it might be a good change to make after work/school hours when network machines are shutdown anyway.

What about unblocking Facebook?

Of course there’s two sides to every coin, so what if you’re on a machine with Facebook blocked? If the site is blocked at the router or DNS level, you are out of luck without knowing the login information for those, or you’ll have to use a proxy service. If you suspect the block is on a PC-level, you can simply go through the directions above to see if Facebook has been blocked using any of those methods. For example, if you see the domain included in the hosts file, you can just remove it from the hosts file and you will be able to unblock the site and access it again.

.

Related articles:

Posted by: David Mendez in Security, Tips & Tricks

32 Comments

» Comments RSS Feed

  1. Bobby Nelson says:

    I don’t want it no more I don’t need it

  2. michelle m deocades says:

    I block my facebook account.its hacking all my files.and i have a virus.my picture and video hacking.privacy not goodwork to my f page i use DNS to help for blocking my facebook

  3. Alma says:

    I use OpenDNS to configure my router to block Facebook app on iPhone.

  4. Grammar says:

    You use “effect” incorrectly instead of “affect”.

  5. osa says:

    i follow your steps it says “Access denied”

  6. Eraser says:

    Here’s a revolutionary idea: instead of jumping through increasingly obnoxious hoops to try and block your kids from accessing Facebook, how about educating them about things like that instead? If you prevent 12 year olds from accessing Facebook, then they won’t know how to deal with things like online threats to privacy by the time you feel they are old enough to deal with Facebook. And when they reached that age, they probably have a lot more privacy sensitive things to share than when they’re 12.

  7. Rigid says:

    It is getting to were you can’t even comment on some sites without using one of the social media sign ons. Sheep of the world unite.

  8. i have a problem with my facebook account…there is certain error. I cannot access some of it because of the content bloc. how can i fix it?

  9. ruwan says:

    Some of these are still working…www.facebook.com is still working….

  10. samuel says:

    How can i unblock the facebook. it is not opening in the system, it was blocked,, it is in LAN
    tell me how to overcome this and enable facebook..

  11. Optiker says:

    What i do not understood is actually how you are no longer actually a lot more well-appreciated than you might be right now. You are so intelligent. You recognize therefore significantly on the subject of this matter, produced me in my opinion consider it from so many numerous angles. Its like women and men aren’t interested except it is one thing to do with Woman gaga! Your own stuffs nice. All the time take care of it up!

  12. Bob says:

    You can never actually totally block someone from signing into facebook I have used all these methods and more.
    And if they use Windows Live or Yahoo or Ebuddy, or 15 other web based apps that sign them into facebook.
    They can find a way to get into the piece of junk.
    Basically shutting off the internet is the only way to completely block access to facebook, which is sad of course.

  13. […] a very sneaky cover that certainly hides Facebook well, assuming your company didn’t block Facebook access completely that […]

  14. Nadia says:

    Facebook also bought domain >> https://www.facebook.com

    Until now i cannot block our staff in accessing Facebook!

  15. CIndy Cheung says:

    it says i don’t have permission to save the hosts file on mac

    • ruwan says:

      Just change the files permission..

      • Raj says:

        How? Where do I find this file “hosts” on my mac?
        Thanks

      • Cameron says:

        I’m running OS 10.9 and it says I don’t have permission to change the hosts file. When I try to change the permissions, it says I can’t do that for that file. Is this a new security feature? Whatever it is, it renders these instructions useless. :(

  16. Peter says:

    I use a software solution to block facebook access on my computer. http://www.facebooklimiter.com/ this stuff works for me.

  17. Jan says:

    There’s a nifty little add-on for Firefox called LeechBlock which let’s you assign time windows for certain domains with configurable access security.

  18. Steve says:

    I might have to use a block for this website :)
    Though it’s not wasted time, I do peruse this website way too often.

  19. Valashtar says:

    Rebooting the windows PC is not required to update local DNS; simply open a command prompt and type “ipconfig /flushdns”. You’ll get a “Successfully flushed the DNS Resolver cache” message and you should be good to go.”

  20. Sean says:

    I use the /hosts method on my kids iMac and it does the trick, 8 and 11 year olds just don’t need to use some of these sites.

    Parental Controls are also worth looking into.

  21. canpake says:

    facebook, myspace, and related domains are all blocked at the uni libraries here, I think it forces people to study. There is a funny sign that says like “If you want to horse around on the web, do it from your dorm.”

  22. Alberto says:

    Use little snitch and lock the Facebook domain is another good way. So you can have different settings on different machines on a network.

  23. […] https://osxdaily.com/2010/11/21/block-facebook/ Categories: Facebook 21 November 2010 at 09:37 – Comments […]

  24. Bob says:

    I tried this and my schools kids got around the block by typing in http://www.www.facebook.com. I also blocked that and they just added another www in front of that address. Any thoughts??

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site