Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I know that this issue comes up time and time again however I have tried everything I can think of and followed every guide to no avail.
I have enabled apache userdir's like so:
(/etc/httpd/conf/httpd.conf)
Code:
<IfModule mod_userdir.c>
UserDir public_html
</IfModule>
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory "/home/sharedusers/*/public_html">
# order allow,deny
# allow from all
#</Directory>
<Directory /home/sharedusers/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
This is my directory structure:
Code:
[root@donkey ~]# ls -ltr /home/sharedusers/home/sh_test/ -R
/home/sharedusers/home/sh_test/:
total 8
drwxr-xr-x 4 sh_test apache 4096 May 3 15:25 Maildir
drwx--x--x 2 sh_test apache 4096 May 3 15:55 public_html
/home/sharedusers/home/sh_test/Maildir:
total 8
drwxr-xr-x 2 sh_test apache 4096 May 3 15:25 new
drwxr-xr-x 2 sh_test apache 4096 May 3 15:25 cur
/home/sharedusers/home/sh_test/Maildir/new:
total 0
/home/sharedusers/home/sh_test/Maildir/cur:
total 0
/home/sharedusers/home/sh_test/public_html:
total 4
-rwx--x--x 1 sh_test apache 207 May 3 15:55 index.html
[root@donkey ~]#
SELinux:
Code:
[root@donkey ~]# /usr/sbin/setsebool -P httpd_read_user_content on
setsebool: SELinux is disabled.
[root@donkey ~]#
Oups, I've now noticed that you use a different homedir tree (/home/sharedusers/home/sh_test instead of /home/sh_test)
For this to work you need to use DirectoryMatch
Code:
<DirectoryMatch /home(.*)/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</DirectoryMatch>
or use explicitly <Directory /home/sharedusers/home/*/public_html>
Oh dear, still no joy im afraid! I just dont understand it! I have tried:
Code:
<Directory /home/sharedusers/home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
and
Code:
<DirectoryMatch /home(.*)/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</DirectoryMatch>
Log:
Code:
[root@donkey home]# tail /var/log/httpd/error_log
[Tue May 03 18:31:55 2011] [error] [client xx.xx.xx.xx] (13)Permission denied: access to /~sh_test/public_html denied
[Tue May 03 18:31:57 2011] [error] [client xx.xx.xx.xx] (13)Permission denied: access to /~sh_test/ denied
[Tue May 03 18:31:59 2011] [error] [client xx.xx.xx.xx] (13)Permission denied: access to /~sh_test/ denied
[Tue May 03 18:31:59 2011] [error] [client xx.xx.xx.xx] (13)Permission denied: access to /~sh_test/ denied
Code:
http://xx.xx.xx.xx/~sh_test/
Forbidden
You don't have permission to access /~sh_test/ on this server.
Apache/2.2.3 (CentOS) Server at xx.xx.xx.xx Port 80
OK, start from / and list the permissions of all folders:
Code:
ls -ld /
ls -ld /home
ls -ld /home/sharedusers
ls -ld /home/sharedusers/home
ls -ld /home/sharedusers/home/sh_test
ls -ld /home/sharedusers/home/sh_test/public_html
All directories must be 755 and the files inside public_html 644 (at least)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.