Fedora Linux Support Community & Resources Center
  #1  
Old 5th August 2011, 03:57 PM
fabsbsd Offline
Registered User
 
Join Date: Jan 2010
Posts: 6
linuxfirefox
public_html: 403 forbidden

Hi!

I tried everything, turned off selinux, added (even with selinux=permissive):

# setsebool -P httpd_enable_homedirs 1
# semanage fcontext -a -t httpd_sys_content_t '/home/user01/public_html(/.*)?'
# restorecon -vvFR /home/user01/public_html

# chmod 711 /home/user01/public_html


in httpd.conf:

<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#

#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html

</IfModule>

<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch ExecCGI 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 this is not working....

Am I missing something?

Thanks !!
Reply With Quote
  #2  
Old 5th August 2011, 04:04 PM
Miikka's Avatar
Miikka Offline
Registered User
 
Join Date: Apr 2011
Location: Finland
Posts: 292
linuxfirefox
Re: public_html: 403 forbidden

Try chmod 755 instead of 711.
Reply With Quote
  #3  
Old 5th August 2011, 04:15 PM
fabsbsd Offline
Registered User
 
Join Date: Jan 2010
Posts: 6
linuxfirefox
Re: public_html: 403 forbidden

Thx Miikka!

Been there, done that

I tried even 777, not working....
Reply With Quote
  #4  
Old 5th August 2011, 04:37 PM
magnusk's Avatar
magnusk Offline
Registered User
 
Join Date: Sep 2008
Location: Arlov, Sweden
Posts: 42
linuxfirefox
Re: public_html: 403 forbidden

Did you chmod 755 public_html ?
__________________
F17 x86_64 Gnome.
Reply With Quote
  #5  
Old 5th August 2011, 04:56 PM
fabsbsd Offline
Registered User
 
Join Date: Jan 2010
Posts: 6
linuxfirefox
Re: public_html: 403 forbidden

yup

drwx--x--x. 3 user01 user01 4096 Aug 4 18:18 public_html

also

drwxr-xr-x. 3 user01 user01 4096 Aug 4 18:18 public_html/

none of these worked
Reply With Quote
  #6  
Old 5th August 2011, 07:25 PM
Miikka's Avatar
Miikka Offline
Registered User
 
Join Date: Apr 2011
Location: Finland
Posts: 292
linuxfirefox
Re: public_html: 403 forbidden

You should be using -R option to change permission to both folder and the files inside.

Code:
chmod 755 -R ~/public_html/
Reply With Quote
  #7  
Old 6th August 2011, 12:23 AM
fabsbsd Offline
Registered User
 
Join Date: Jan 2010
Posts: 6
linuxfirefox
Re: public_html: 403 forbidden

Yp, everything inside have enough permissions... I have the same config and permissions in CentOS 6 with no issues...

---------- Post added at 06:23 PM ---------- Previous post was at 05:38 PM ----------

solved, you need to change the home directory

chown 711 /home/user01

thanks!
Reply With Quote
  #8  
Old 6th August 2011, 12:44 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 7,346
linuxfedorafirefox
Re: public_html: 403 forbidden

Do an "ls -lZ public_html". If you didn't give apache the SELinux permissions to read user home directories, that is what you get.

Both the SELinux boolean (httpd_enable_homedirs) must be set, AND the users public_html must have the SELinux type (httpd_user_content_t, or httpd_user_rw_content_t if it is to be written to) must be set. Normally httpd_user_content_t is on the directory, but files/subdirectories can have the "httpd_user_rw_content.
Reply With Quote
  #9  
Old 12th August 2011, 01:20 AM
gurutech Offline
Registered User
 
Join Date: Nov 2008
Location: Central NJ
Posts: 379
windows_7firefox
Re: public_html: 403 forbidden

I think I may be having the same problem. I followed the steps here, but I cannot view any ~username websites, only the default one located in /var/www/html
Reply With Quote
  #10  
Old 12th August 2011, 01:30 AM
fabsbsd Offline
Registered User
 
Join Date: Jan 2010
Posts: 6
linuxfirefox
Re: public_html: 403 forbidden

Checklist:

httpd.conf?
semanage fcontext?
setsebool home dirs?
chmod 711 ~username ?
chmod 711 ~username/public_html ?
chmod -R 755 ~username/public_html/* ?

Cheers!
Reply With Quote
  #11  
Old 12th August 2011, 02:22 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 7,346
linuxfedorafirefox
Re: public_html: 403 forbidden

And don't forget:

chcon -R -t httpd_user_content_t ~username/public_html/*
Reply With Quote
  #12  
Old 12th August 2011, 07:33 AM
crolma4 Offline
Registered User
 
Join Date: May 2007
Location: Cleveland, spiritual center of the rust belt
Posts: 34
linuxfirefox
Re: public_html: 403 forbidden

I have not tested it, but you may need to change security context on parent directories. My situation was:
(1) Works fine out of /var/www/html/
(2) But wait, I can't have a couple of hundred gig of mundane files under /var, need a symlink. Could change the document root, I guess, but I like having the core files of my web server where they're supposed to be by default.
(3) Apache documentation is hard to follow, but the f15 httpd.conf file looks OK for this problem, and it turns out that you don't have to touch it.
(4) memories for the last web server setup tell me to adjust the security context (# chcon), but it's not enough.

Now, I had a symlink to /srv/share, where /srv is a different hard disk and /srv/share is a collection of user directories intended for others to be able to read. error_log and apache's error message were only a bit helpful. ((apache's message says I can't access /share/blah/blah.css. Note that "share" is also the name of symlink in /var/www/html/ that points to /srv/share, but appache's message makes it look like it thinks there's a directory /share on the file system. Obviously, the message really speaks from the assumption that / is actually /var/www/html/)

Anyway, when I changed the security context of /srv to httpd_sys_content_t, things started to work. It didn't seem to be enough for just /srv/share to have this context. It didn't matter that I wasn't trying to access /srv itself. My theory is that if you symlink to /a/b/c/d, then you need read permissions and security context to be set for a,b, and c as you would set them for d.

After that, I still had errors, but these were simply files that didn't have read permissions set for others, and the message in error_log pointed me straight to it.

Looking at my previous web server setup, I had this virtual host thing going on. I remember grasping at straws, so I must have stumbled on a weird work-around. I didn't want to re-create it. Happy to say I didn't have to change my web server conf at all. (I tried various modifications, but in the end I took them all out).
Reply With Quote
  #13  
Old 5th August 2017, 07:03 AM
skitten Offline
Registered User
 
Join Date: Dec 2011
Location: San Francisco
Posts: 7
windows_98_nt_2000chrome
Re: public_html: 403 forbidden

Just ran into this on F26, because SELinux is always the root of all problems on a new install. Had to do:

setsebool httpd_enable_homedirs true
Reply With Quote
  #14  
Old 5th August 2017, 12:08 PM
smr54 Online
Registered User
 
Join Date: Jan 2010
Posts: 7,129
linuxchrome
Re: public_html: 403 forbidden

Note that you're replying to a thread from 2011. Which doesn't mean the information is irrelevant, as apparently SELinux still causes issues with apache, but useful to keep in mind.
Reply With Quote
  #15  
Old 6th August 2017, 06:14 AM
skitten Offline
Registered User
 
Join Date: Dec 2011
Location: San Francisco
Posts: 7
windows_98_nt_2000chrome
Re: public_html: 403 forbidden

I know, but since this is the thread that came up when I googled for it I thought I'd leave a tip for anyone else searching.
Reply With Quote
Reply

Tags
403 , forbidden , publichtml

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can't make public_html GalGavu Servers & Networking 2 12th September 2009 08:43 AM
VSFTPD+public_html flatproject Servers & Networking 0 28th February 2006 06:07 PM
apache and public_html teethlikelions Servers & Networking 4 20th November 2005 10:34 PM
Probs with ~/public_html pie Using Fedora 1 16th May 2005 11:13 AM


Current GMT-time: 08:25 (Saturday, 21-10-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat