LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-12-2010, 07:59 PM   #1
memilanuk
Member
 
Registered: Sep 2010
Location: Washington state, USA
Distribution: Ubuntu among others
Posts: 75

Rep: Reputation: 5
Trouble setting up Apache per-user directories


Hello all,

I've got an older PC loaded with a basic server install of Ubuntu 10.04.1 LTS. I installed LAMP via tasksel, and webmin as well. Access over the LAN to the server ip address shows the default 'It works!' page on port 80, I can get to the phpmyadmin page, I can get into webmin, etc. What I *can't* seem to do is get per-user directories working.

I enabled the Userdir module via webmin, created the /home/monte/public_html directory, populated it with a simple index.html file, changed the ownership of the directory to monte:www-data, set the permissions of the directory (and the files inside) to 0775... and I still get a "403 Forbidden: You don't have permission to access /~monte on this server" message when I try to navigate to server-ip/~monte.

Any ideas or suggestions would be most welcome.

TIA,

Monte
 
Old 10-12-2010, 08:38 PM   #2
karthik_kce
LQ Newbie
 
Registered: Jul 2008
Location: Bangalore, India
Posts: 6

Rep: Reputation: 0
Hi,

Please check the access log and error log of the apache service.... Access log will show the exact directory that is being accessed... Also verfiy your virtual host entry...

If you can't troubleshoot, plz paste the error messages in the access log file here..

-Karthik
 
Old 10-12-2010, 08:45 PM   #3
memilanuk
Member
 
Registered: Sep 2010
Location: Washington state, USA
Distribution: Ubuntu among others
Posts: 75

Original Poster
Rep: Reputation: 5
Hmmm... looks like I need to set my user directory permissions to 0751 (not the default on Ubuntu, apparently) to allow read access of the files by apache2. Is there a better way to do this? Given the choice I'd rather the user home directory itself have 0700 permissions, and finagle group memberships to make this work... is that a realistic goal and how should I proceed - add users to the www-data group, etc.?

Monte
 
Old 03-13-2011, 03:29 PM   #4
samuel.b.johnson
LQ Newbie
 
Registered: Mar 2011
Location: Upstate New York
Distribution: Ubuntu
Posts: 1

Rep: Reputation: 0
I ran into the same problem. Rather than changing the permissions of my user directory, I created a directory within /var/www specifically for per-user directories. Then I created a directory for each user (easy for me, since currently I'm the only user) with that user as the owner and group. Then I created a link in my user directory from that per-user directory, and called the link public_html, so it creates roughly the same effect from the user's perspective, but without the security problems of changing the permissions for the user directory.

sudo mkdir /var/www/users/
sudo mkdir /var/www/users/someUserDir
sudo chown someUser:someUser someUserDir
sudo chmod 751 /var/www/users/someUserDir

sudo ln -s /var/www/users/SomeUserDir /home/someUser/public_html

At this point, if you're "someUser," you can simply treat the public_html as if it's a directory, and the permissions problem goes away. I don't know that this is the best way to do it--I'd certainly be open to suggestions for a more elegant solution.

--Sam
 
  


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
User directories on apache Haschas Linux - Server 5 10-18-2009 06:15 PM
User directories in apache bzlaskar Linux - Server 3 04-18-2007 06:23 AM
Apache user directories permissions Wordan Linux - Networking 9 07-14-2006 04:42 PM
Creating user directories in Apache root robojerk Linux - Networking 1 09-21-2004 01:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:19 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