Coolestguidesontheplanet.com | Neil Gee

coolest guides on the planet

Coolest Guides On The Planet

Neil Gee

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Forbidden 403, You don’t have permission to access /~username/ on this server

October 20, 2014 13 Comments

osx-forbidden

OS X 10.10 / 10.9 Sites Folder Sharing Not Working

If your user personal web sharing is not working for a user but is OK at the other document root localhost level, the issue may be a configuration file for the user.

The higher document root level of http://localhost/  displays “It Works” but when going to the user level,  http://localhost/~username/ you get the:

Forbidden 403, You don’t have permission to access /~username/ on this server

Check that you have a “username.conf” filed under:

/etc/apache2/users/

If you don’t, then create one named by the short username of the account with the suffix .conf:

Find your short username by typing in the Terminal

whoami

Change directory into the right directory:

cd /etc/apache2/users

sudo nano username.conf

For OSX 10.9 Apache 2.2

Then add the content below swapping in your username:

<Directory "/Users/username/Sites/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

For OSX 10.10 Apache 2.4

Then add the content below swapping in your username:

<Directory "/Users/username/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>

Permissions on the file should be:

-rw-r--r--   1 root  wheel  298 Jun 28 16:47 username.conf

This is documented at Apple.

Restart apache

 sudo apachectl restart

Then all should be good.

Changing The Apache Web User

One of the frustrations of using the Users/username/Sites folder is the permissions issues with things like updates and authentication.

This is because the default webserver user which runs httpd is known as _www, which will not be the user in your local account. If your machine is only in use by you and the webserver will run only under your account then you can change the user.

Change this back in /etc/apache2/httpd.conf

 

osx-yosemite-webserveruser

Just change it to your username and group, group will be staff and restart Apache

 sudo apachectl restart

Share this:

  • Twitter
  • Google
  • Facebook

Related

Cats: macOS, Tech Tags: apache, mac, OSX, permissions, sharing, web

  • Mike Uwins

    Thanks man.  Looked all over for a fix for this and this nailed it in one. 🙂

  • Daniel Shanahan

    This video was very helpful (http://youtu.be/cMhSyxmbHu0), even though it was on a Windows machine; a change may be needed in httpd.conf file (/etc/apache2/httpd.conf) from this:
    # First, we configure the “default” to be a very restrictive set of 
    # features.  
    #

        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
    to this# First, we configure the “default” to be a very restrictive set of 
    # features.  
    #

        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Allow from all
    And further down in the same file:    # Controls who can get stuff from this server.
        #
        Order allow,deny
        Deny from allto this    # Controls who can get stuff from this server.    #    Order allow,deny    Allow from all

  • Jhig85

    Might be a stupid question, but when do you type the permission for the file? I have opened the username.conf file in terminal. I was just wondering when to type the permission part. Thanks.

    • Neil Gee

      doesn’t matter when

Subscribe

Coolest Guides on the Planet
  • Latest
  • Popular
  • Comments
  • Remove MySQL instance from macOS or OSX via the command line Remove MySQL instance from macOS or OSX via the command line
  • Set Up Let’s Encrypt SSL on cPanel WHM Server Set Up Let’s Encrypt SSL on cPanel WHM Server
  • Compare the diff of 2 folders in the Command Line Compare the diff of 2 folders in the Command Line
  • iOS IPSW Firmware Download Links 9.3.4, 9.3.3, 9.3.2, 9.3.1, 9.3.0, 9.2.1, 9.2.0, 9.1.0, 9.0.2, 9.0.1, 9.0.0, 8.4.1, 8.4, 8.3, 8.2, 8.1.3, 8.1.2, 8.1.1, 8.1.0, 8.0.2, 8.0.1, 8, 7.1.2, 7.1.1, 7.1, 7.0.6, 7.0.5, 7.0.4, 7.0.3, 7.0.2, 7.0.1, 7, 6.1.3, 6.1.2, 6.1, 6.0.1, 6, 5.1.1, 5.1, 5.0.1 iOS IPSW Firmware Download Links 9.3.4, 9.3.3, 9.3.2, 9.3.1, 9.3.0, 9.2.1, 9.2.0, 9.1.0, 9.0.2, 9.0.1, 9.0.0, 8.4.1, 8.4, 8.3, 8.2, 8.1.3, 8.1.2, 8.1.1, 8.1.0, 8.0.2, 8.0.1, 8, 7.1.2, 7.1.1, 7.1, 7.0.6, 7.0.5, 7.0.4, 7.0.3, 7.0.2, 7.0.1, 7, 6.1.3, 6.1.2, 6.1, 6.0.1, 6, 5.1.1, 5.1, 5.0.1
  • Get Apache, MySQL, PHP and phpMyAdmin working on macOS Sierra Get Apache, MySQL, PHP and phpMyAdmin working on macOS Sierra
  • Today Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Today Week Month All
  • Clear the local DNS cache in OSX 10.11 El Capitan, Linux and Windows Clear the local DNS cache in OSX 10.11 El Capitan, Linux and Windows
Ajax spinner

Tags

apache backup baseband Bing boot Coolest Guy on the Planet Coolest Guy Planet cpanel css custom database drupal el capitan error Firmware Google image instadmg ios iphone jailbreak keys Keywords lion mac mysql OSX PageRank php private public Rank Rank Checker ranking redirect remote rsa SEO SERPS shell ssh terminal Twitter unstoppables Yahoo
WordPress Workflow
Get DesktopServer
StudioPress Premium WordPress Themes

Donate a Beer to the Coolest Guides

Copyright © 2016· Neil Gee - All Rights Reserved - Hosted by Servint