DarthVader DarthVader - 1 year ago 90
Apache Configuration Question

Php accessing Home directories

I have a script and i d like to access to home directories of users in a Linux Environment.

Web root : /var/www/html/
And there are user directories such as : /home/john

There are files in users home directories. The permissions of user homes belong to the users. eg:
/home/david/file.txt user: david group: david

Is it possible to access these files with apache? I assume it s not because of the permission,

Is there a way around this ?

in other words, my php program under /var/www/html/index.php can acccess the files under /home/david/foo.txt

How can i get this done? Thanks.

Answer Source

The best way would be to have the users place the specific needed files into a pub directory, then chmod 777 that directory.

If you want to access arbitrary files in the home directory, you have to run Apache as root, which is a big security risk. (While you could change the permissions of the home directory, this can mess up a lot of programs, in my experience.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download