eHow launches Android app: Get the best of eHow on the go.

How To

How to Block Websites on Safari

Contributor
By Catherine Chant
eHow Contributing Writer
(2 Ratings)

You can block websites on Safari quite easily with the OS X operating system's built-in parental controls, which can be enabled by setting up individual accounts with different access privileges for members of your family. The parental controls, however, do not block other web browsers, such as Firefox, from accessing websites on the Macintosh. A more thorough way to block websites from Safari and all browsers is to edit the hosts file in the Macintosh system and redirect blocked website addresses back to the local machine so the browser can't find them.

Difficulty: Moderately Easy
Instructions

Things You'll Need:

  • Terminal utility (optional)

    Create a User Account with Parental Controls

  1. Step 1

    Open the "System Preferences" utility located in the Applications folder on OS X.

  2. Step 2
    System Preferences Window
     
    System Preferences Window

    Click the "Accounts" icon in the System row.

  3. Step 3
    Unlock to add accounts
     
    Unlock to add accounts

    Click the "lock" icon at the bottom of the accounts window to enable adding a new account. Enter your admin password when prompted.

  4. Step 4
    Add account button
     
    Add account button

    Click the + plus sign in the lower left to add a new account.

  5. Step 5
    New account window
     
    New account window

    Enter a name, short name, password, the password again and a password hint. Do not check off the "allow admin" box or this user will have full access to the computer, including adding and deleting accounts.

  6. Step 6
    Disable Automatic Login
     
    Disable Automatic Login

    Click "create account" and click the "Turn Off Automatic Login" button when prompted. This will force all users to login every time the computer starts.

  7. Step 7
    Parental control tab
     
    Parental control tab

    Click on the name of the new user in the list on the left side of the screen and click the "Parent Controls" tab at the top of the screen.

  8. Step 8
    Configure Safari controls
     
    Configure Safari controls

    Click the check box next to Safari and click the "Configure" button to the right. The system will tell you to login as the new user and open Safari to configure the sites the user is allowed to visit.

  9. Step 9

    Return to Finder and select "Log Out" under the Apple menu, then login as the new user.

  10. Step 10

    Launch Safari and select "Preferences" and then "Security" from the Safari menu.

  11. Step 11

    Click to un-check the box next to "Enable Parental Controls." Enter your admin password and close the preferences box.

  12. Step 12

    Add bookmarks for all the allowed sites to the bookmarks bar and remove all other bookmarks.

  13. Step 13

    Return to Safari, and go to "Preferences" and "Security." Check off the box for "Enable Parental Controls" again and enter your admin password to lock in your changes. Now, only the sites you have bookmarked are accessible in this user account.

  14. Edit Hosts File with the Terminal Utility

  15. Step 1
    Terminal application icon
     
    Terminal application icon

    Open the application Terminal which is located in "Applications"-->"Utilities" folder.

  16. Step 2

    Type the command: cp /etc/hosts ~/Desktop/hosts.txt to copy your current hosts.txt file to the desktop as backup.

  17. Step 3

    Type the command sudo pico /etc/hosts.

  18. Step 4

    Enter your Macintosh admin password and press Return/Enter.

  19. Step 5
    Add domain name to hosts file
     
    Add domain name to hosts file

    Use the arrow key to move the block cursor down to the bottom of the file and enter the IP address 127.0.0.1 followed by the domain name you want to block. This tells the computer that the address for that domain is now IP number 127.0.0.1, which is your local Macintosh. Thus, the browser won't be able to resolve that domain to a web page.

  20. Step 6

    Hold down the CTRL key and type X to exit after you have entered all the domains you wish to block, on separate lines. You will be prompted to save. Type Y for Yes.

  21. Step 7

    Press Return/Enter again to confirm the file you want to write to is /etc/hosts.

  22. Step 8

    Click the "Terminal" menu and select "Quit Terminal" to exit.

  23. Step 9
    Website successfully blocked
     
    Website successfully blocked

    Open Safari and type in the domains you blocked in the hosts file. All other browsers on your machine will be blocked from accessing that domain as well. You can enter as many domains as you want into the hosts file, but put each command on a new line and remember this action blocks them from all users of the computer, including you.

Tips & Warnings
  • You can enter 0.0.0.0 for the IP address in the hosts file as well. It's equivalent to 127.0.0.1. When using Mac OS X parent controls for Safari, test the websites you allow and make sure they are usable. Some sites redirect to other domains under their control. If that happens, you will need to allow the other domain for the site to be fully functional.
Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Internet Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

Demand Media
eHow_eHow Technology and Electronics