LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-17-2006, 11:09 AM   #1
spectre_25gt
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Rep: Reputation: 0
Serving HTTP From Home Folders


Ok, I'm trying to set things up so that if I go to $website.$username.server.com it will serve files from /home/$username/dev/www/$website/. Unfortunately, I can't figure out how to set up the permissions so that Apache can read the files.

I've tried setting permissions so that /home/$username/dev/www/ and below are readable by apache but apache still can't get to it because the permissions higher up in the hierarchy don't allow it. I really don't want to make my users entire home folders readable by apache, though.

Also, what can I do to ensure that files created or moved into that folder keep www-data as the group and the correct permissions are inherited? Should I make my users that deal with those files part of the www-data group?
 
Old 03-17-2006, 11:33 AM   #2
doublejoon
Member
 
Registered: Oct 2003
Location: King George, VA
Distribution: RHEL/CentOS/Scientific/Fedora, LinuxMint
Posts: 370

Rep: Reputation: 44
Quote:
Originally Posted by spectre_25gt
Ok, I'm trying to set things up so that if I go to $website.$username.server.com it will serve files from /home/$username/dev/www/$website/. Unfortunately, I can't figure out how to set up the permissions so that Apache can read the files.

I've tried setting permissions so that /home/$username/dev/www/ and below are readable by apache but apache still can't get to it because the permissions higher up in the hierarchy don't allow it. I really don't want to make my users entire home folders readable by apache, though.

Also, what can I do to ensure that files created or moved into that folder keep www-data as the group and the correct permissions are inherited? Should I make my users that deal with those files part of the www-data group?


Hmm ...you didn't say what distro you were running, but from what you posted. I'm goin to assume its Red Hat Enterprise Linux 4, Fedora, or something similar

If you are running Selinux I would set the security context on that /home/$username/dev/www/ directory

say something like

Code:
chcon -R -h -t httpd_sys_content_t /home/$username/dev/www/
then to check things out

Code:
ls -Z /home/$username/dev/www/
should get something like this in output

Code:
object_r:httpd_sys_content_t
 
Old 03-17-2006, 12:53 PM   #3
spectre_25gt
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Actually I'm running Ubuntu. Sorry I failed to mention the distro.
 
Old 03-17-2006, 01:37 PM   #4
doublejoon
Member
 
Registered: Oct 2003
Location: King George, VA
Distribution: RHEL/CentOS/Scientific/Fedora, LinuxMint
Posts: 370

Rep: Reputation: 44
k Gotcha!

Hmm


try

Code:
chown -R apache.www-data /home/$username/dev/www/
then

Code:
chmod -R g+s /home/$username/dev/www/
now any file created in /home/$username/dev/www/ will belong to group www-data



you using Virtual host directives?

Last edited by doublejoon; 03-17-2006 at 01:44 PM.
 
Old 03-17-2006, 04:02 PM   #5
spectre_25gt
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Original Poster
Rep: Reputation: 0
I am.

Code:
<VirtualHost *>
      ServerName $developmentSiteFQDN.$username.dev.myFQDN
      DocumentRoot /home/$username/dev/www/developmentSiteFQDN
</VirtualHost>

I tried what you suggested and I'm getting this error in apache's error.log: Permission denied: home/$username/dev/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

So it looks like apache needs access to /home/$username/dev/ as well. Does that sound right?

Edit:
Ok, I've got it working. I ended up just being a little bit more lenient with the permissions on my home folder and tightening up the subdirectories instead.

Last edited by spectre_25gt; 03-18-2006 at 03:08 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
is it possible to access windows xp home shared folders? kahn Linux - Networking 5 07-03-2005 07:01 AM
Sharing folders in Samba which are not in the HOME path ganja_guru Linux - Software 22 11-29-2004 09:18 AM
Serving up my mp3 library at home through a firewall at work nbcthreat Linux - Networking 3 07-08-2004 08:57 AM
Why Two Home Folders? pheonix Linux - Newbie 8 02-16-2004 10:36 PM
Sharing folders not in your home FrozenShadow23 Linux - Newbie 2 09-28-2003 01:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration