You don’t have permission to access….

I was trying to set up Web Sharing (apache) to try out Coda, Panic’s pretty cool editor.

After enabling Web Sharing, I tried to access:

http://localhost/~USER/

(where USER is my user name), however I was greeted with “You don’t have permission to access this page”

I checked all of my permissions on /Users/USER/Sites/ etc, everything was fine.

Then I made a new user, which worked. I kept hunting around and finally found the problem.

When I used Migration Assistant to copy data from my old Mac to this one, Migration Assistant did not copy the apache configuration file. Oops. In order to fix this, you’ll need terminal and Text Edit.

  1. Make a new user
  2. Enable Web sharing (to force creation of a template configuration file)
  3. Open /Applications/Utilties/Terminal.app
  4. Enter ‘sudo ls /etc/apache2/users/’ without the quotes and press RETURN. Enter your admin password to continue.
  5. Note the <NEWUSER>.conf file listed there
  6. Enter ‘sudo cp /etc/apache2/users/<NEWUSER>.conf <USER>.conf’ replacing <NEWUSER> with the name of the new user you created, and <USER> with the name of the broken user. Press return.
  7. Open Text Exit.app
  8. Press CMD-O to open the choose file box
  9. Press the / key to open a “go to folder” dialog
  10. Type in ‘/etc/apache2/users’ without the quotes.
  11. Open your <USER>.conf file
  12. In the first line, change <Directory "/Users/<NEWUSER>/Sites/"> to <Directory "/Users/<USER>/Sites/">
  13. Save your document
  14. Turn Web Sharing off, then back on

Whew! Things should work now.

Time to file a bug with Apple.