0

I tried to block Facebook on Chrome by changing the hosts file but to no avail. What could possibly went wrong?

  1. Modifying hosts file does not have any effect

I followed exactly what the op did and rebooted, but I could still have access to Facebook.

doesn't work I have root access

  • 1
    Your hosts file is completely broken. There should be no space after any dot in a hostname. Remember: It's facebook.com not facebook. com. The latter one assigns only facebook. to another IP. Any errors in the hosts file is silently ignored and that's it. – GiantTree Apr 20 '16 at 12:51
  • I'm guessing whatever keyboard you are using assumes the periods to be line ends and adds the space for you during the construction of these lines. Investigate how to turn that off while composing this file. – wbogacz Apr 20 '16 at 12:56
  • @GiantTree If you look at the second screenshot, that appears to have spaces too, in a place you wouldn't expect any. I suspect it's an awful font rather than spaces actually in the file. – Dan Hulme Apr 20 '16 at 12:57
  • As a plus to what @GiantTree said, I'll point out that lines 3 and 4 do nothing. – Grimoire Apr 20 '16 at 12:57
  • @DeathMaskSalesman depends on the local network. If one host has the hostname facebook (that's possible) then it's blocked as well. It's just not needed because there won't be a host with that hostname. – GiantTree Apr 20 '16 at 13:00
0

Just try adding these three hosts name and replace ip address 127.0.0.1

    facebook.com  
    www.facebook.com  
    m.facebook.com
    mobile.facebook.com

As I checked when typed facebook.com, the site will be redirected to m.facebook.com, so we won't be able to access.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy