# Apache2 user directories don't work

## Flux-

I just installed Apache 2. It shows fine my documenroot, but when I try to access an user directory I got a 403 Forbidden error.

I think the problem is in these parts of commonapache2.conf

```

<Directory />

  Options Indexes FollowSymLinks Multiviews

  AllowOverride None

  <IfModule mod_access.c>

    Order deny,allow

    Deny from all

  </IfModule>

```

```

<Directory /home/*/public_html>

    AllowOverride All

    Options MultiViews Indexes Includes FollowSymLinks

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory>

```

But I don't have any idea how to solve it.

I have tried many different permissions for public_html directory, but it hasn't help.

----------

## ckdake

post the permissions for your user folder and your public_html folder.  

i have :

```

<Directory /home/*/public_html>

    AllowOverride All

    Options MultiViews +Indexes Includes FollowSymLinks

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory>

```

in my commonapache2.conf

and:

```

ckdake@zion ckdake $ ls -al

total 60

drwx--x--x    7 ckdake   users        4096 Nov 22 12:15 .

drwxr-xr-x   19 root     root         4096 Nov 21 23:54 ..

...

drwxr-xr-x   11 ckdake   users        4096 Nov 22 18:09 public_html

ckdake@zion ckdake $ cd public_html/

ckdake@zion public_html $ ls -al

total 72

drwxr-xr-x   11 ckdake   users        4096 Nov 22 18:09 .

drwx--x--x    7 ckdake   users        4096 Nov 22 12:15 ..

...

drwxr-xr-x    5 ckdake   users        4096 Nov 22 18:09 gentoo

...

-rwxr--r--    1 ckdake   users        1073 Nov 17 21:37 index.php

...

```

and everything seems to work just fine on my server.  

post the coresponding entry in /var/log/apache2/error_log

----------

## Flux-

Permissions for userfolder:

```

flux@yume flux $ ls -al

total 48

drwx------    9 flux     users        4096 Nov 23 14:45 .

drwxr-xr-x    4 root     root         4096 Nov 16 23:56 ..

drwxr-xr-x    2 flux     users        4096 Nov 23 18:03 public_html

```

public_html:

```

flux@yume flux $ cd public_html/

flux@yume public_html $ ls -al

total 12

drwxr-xr-x    2 flux     users        4096 Nov 23 18:03 .

drwx------    9 flux     users        4096 Nov 23 14:45 ..

-rwxr-xr-x    1 flux     users          52 Nov 23 18:03 index.html

```

And the commonapache2.conf:

```

<Directory /home/*/public_html>

    AllowOverride All

    Options MultiViews Indexes Includes FollowSymLinks

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory> 

```

----------

## ckdake

All of that looks fine.

post the lines from /var/log/apache2/error_log  that give the specific error when you try to access the page.

----------

## Flux-

From the error_log:

```

[Sun Nov 23 21:08:27 2003] [error] [client 80.186.34.96] (13)Permission denied: access to /~flux denied

```

It says the same for all users I try. So there must be still something that limits the permissions.

----------

## ckdake

try putting a / on the end of the url, and try typing in the full url to the index.html file and post those error logs.   Looking through my error_log, the only problems beginning with "(13)Permisison denied"  are when one of my users set up his phblic_html and didn't set his permissions properly. 

are you restarting apache2 each time you change the configuration file?

also, may help to post the relevant access_log entries for your tests that give you the error...

----------

## Flux-

error_log:

```

[Sun Nov 23 21:18:11 2003] [error] [client 80.186.34.96] (13)Permission denied: access to /~flux denied

[Sun Nov 23 21:28:44 2003] [error] [client 80.186.34.96] (13)Permission denied: access to /~flux/ denied

[Sun Nov 23 21:28:48 2003] [error] [client 80.186.34.96] (13)Permission denied: access to /~flux/index.html denied

```

access_log:

```

80.186.34.96 - - [23/Nov/2003:21:18:11 +0200] "GET /~flux HTTP/1.1" 403 421 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030827"

80.186.34.96 - - [23/Nov/2003:21:28:44 +0200] "GET /~flux/ HTTP/1.1" 403 422 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030827"

80.186.34.96 - - [23/Nov/2003:21:28:48 +0200] "GET /~flux/index.html HTTP/1.1" 403 432 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030827"

```

I have restarted apache2 every time of course.

Here are the both conf-files too, if they are necessary:

http://yume.ath.cx/apache2.conf

http://yume.ath.cx/commonapache2.conf

----------

## ckdake

hmm.. thats kinda weird.  since you have "Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request." on your error page, it leads me to think that the problem is not with the user directory part of your setup, but something else.

I seem to remember someone with a simliar problem and i think it was because of symbolic links.

looking through you commonapache2.conf :

```

<IfModule mod_userdir.c>

    UserDir public_html

    UserDir enabled flux linnea

    UserDir disabled root

</IfModule>
```

I don't know the specifics of the UserDir directive, but try taking out the second two lines. mine is:

```

<IfModule mod_userdir.c>

    UserDir public_html

</IfModule>
```

My guess is userdir specifies the directory to use so you are telling it to use the directory "disabled" or "root".

Try that and post back what happens,  other than that your conf files look good to me..

----------

## Flux-

Oh, I actually totally forgot those. I removed them, but it didn't help :(

Still the same error in error_log. This is just too strange :/

----------

## ckdake

Still pretty weird, so i busted out diff and downloaded your config files,  here are the relevant diff files, though i removed a lot of stuff from the commonapache2.conf because I have a lot of custom location tags.  This should help cause my server works and yours doesnt and these are the differences. heh:

http://chris.ithought.org/gentoo/flux/apache2.conf.diff.txt

http://chris.ithought.org/gentoo/flux/commonapache2.conf.diff.txt

----------

## Flux-

I made the changes in my conf files (ok, not the servername and commented etc. ;) and restarted apache2. Still I got the same error. I guess the problem isn't then in apache2 conf files or in folder permissions. Are there any possibilites left anymore?

I want to get those user folders to work :)

----------

## fleed

Your user directory must have eXecute permissions for others in order for the apache user to be able to chdir to public_html.

So it should look like (from your message below):

```
flux@yume flux $ ls -al

total 48

drwx-----x    9 flux     users        4096 Nov 23 14:45 .

drwxr-xr-x    4 root     root         4096 Nov 16 23:56 ..

drwxr-xr-x    2 flux     users        4096 Nov 23 18:03 public_html 
```

instead of 

```
flux@yume flux $ ls -al

total 48

drwx------    9 flux     users        4096 Nov 23 14:45 .

drwxr-xr-x    4 root     root         4096 Nov 16 23:56 ..

drwxr-xr-x    2 flux     users        4096 Nov 23 18:03 public_html 
```

(note the extra x at the end of the first line.)

You prolly know this but just do 

```
chmod a+x /home/flux
```

 to fix it.

----------

## Flux-

Wow, it works now. Thank you :)

----------

