I installed PHP (package php5 (Apache came automatically with it)) and the root folder for Apache is standard (/var/www/html).

The folders I want to link in there (or somehow let Apache access them, I don't care whether or not it's a link) are in my home directory. What is the best way (giving away the least permissions) to achieve this? I know that this is going off topic, but if there is a way to let Eclipse copy files before executing them, let me know to answer this question, because then my problem would cease to exist.

My problem isn't resolved by the accepted answer of this question. I still get a 403 Forbidden:


You don't have permission to access /l on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80

(I named the link to the folder in my home directory l.)

I made sure that Apache follows symbolic links by creating a link inside /var/www/html to something else in /var/www/html and accessing the link in a browser.


I solved the problem by doing the following.

1) Allow other users to access the partition:

sudo chmod 751 /home

2) Allow Apache to access your www files (no need to be your entire home folder)

sudo chgrp www-data /home/[username]
sudo chgrp www-data /home/[username]/public_html/ -R

I figured it out: I changed the permissions of /home/ and /home/[username] to 755 and from there on all the folders to my link target folders also to 755. For some PHP applications it's necessary to set files in there to 755.

  • changing any permissions to 755 is a bad idea and certainly not a solution. – guntbert Oct 17 '15 at 18:37
  • @guntbert Yeah, I just figured that one out, too. I wasn't concerned about other users, since not only am I the only user of my machine, but also because my home folder is encrypted which means there's nothing there anyway, when I'm not logged in. But it caused some other trouble. Anyway, do you have a better solution? – UTF-8 Oct 17 '15 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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