1

im using Ubuntu 14.04, and got problem with apache configuration:

i created a Symlink in /var/www/html (the apache DocRoot since Ubuntu 14.04) torwards /home/me/myWebDirectory

  • cd /var/www/html
  • ln -s /home/me/myWebDirectory myWebDirectory

but localhost/myWebDirectory renders a

403-permission denied

and in fact, sudo -u www-data ls /home/me/myWebDirectory returns a permission denied too

apache2.conf had following directive :

    <Directory /var/www>
           Options Indexes FollowSymLinks
           AllowOverride None
           Require all granted
 </Directory>

i changed it for <Directory /var/www/html>

but no result.

i tried to add the me user to www-data group with following command but it didnt help either : sudo usermod -a -G www-data me

what is it that i miss ??

EDIT: i changed the group of /home/me/myWebDirectory into www-data with rx rights, but no success either...

NB 1: i know there's another way to do it, while activating the apache mod_userdir and that's probably what i'll be going to do next. But first i'd like to understand how to make this "simple" solution work...

NB 2: i know as well i could create a VirtualHost and so on, but again, i'd like first to understand why this simple (first and temporary) solution won't work...

0

When it comes to permissions, I think you got it backwards. Adding user me to www-data does not help, you should add Apache's user to me users group.

Also if you changed only the group rights of /home/me/myWebDirectory, that is not sufficient if /home/me is inaccessible by www-data group. Make sure that users with www-data group can enter /home/me directory itself.

For more granular approach, take a look at POSIX ACL.

  • OK i did deluser me www-data then adduser www-data me to add apache user in the me group. Fyi, ls -lR /home/me/myWebDir returns for all : -rwxr-xr-x me me testfile (example given for a file obviously) while ls -l /var/www/html displays my Symlink : lrwxrwxrwx root root myWebDir -> /home/me/myWebDir. Tho the result is still the same : 403-Permission denied – user219623 May 14 '14 at 13:20
  • ... and how about stat /home/me? – Janne Pikkarainen May 14 '14 at 13:23
  • returns Accès : (0700/drwx------) so if i get u right, i need give read access to the me group ? – user219623 May 14 '14 at 13:27
  • That's what I said in my original answer. :) At minimum chown me:www-data /home/me && chmod 710 /home/me, or better yet, those POSIX ACLs. But, as a light-weight solution, the one I just typed up. – Janne Pikkarainen May 14 '14 at 13:35
  • the lightweight solution will do it for a while, thx very very much! I put this ticket to "solved" status! Just for my general understanding, if i add the www-data user to the me users group and chmod g+r /home/me, it doesnt work, while if i chown me:www-data /home/me, it works. Does it mean apache is using more than one user? – user219623 May 14 '14 at 14:33
0

apache2 needs to be able to read from the beginning of the directory path

sudo chgrp www-data /home/username

add group www-data to username

sudo useradd -g www-data username

and log out and in... worked with me

if it still doesn't work use

sudo chgrp www-data /home/username

try logging out and back in... should work

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.