1

The following is assuming Apache is running as www-data:www-data

I have a directory owned by www-data
Permissions are
U: rxw
G: rxw
O: ---

What I'd like to have happen is when, say a php script runs, it can write to that folder since it'd be running as www-data, but an external user trying to access anything in the directory would be treated as other, and unable to access.

Is that possible. I could swear I've seen some web setups that function in this manner.

1 Answer 1

0

In order to accomplish what you want, the PHP script will need to run as a different user than the web server. The script user would be given permissions to read/write to a folder that www-data cannot access. Here's a question on Server Fault about setting a PHP script to run as a different user

1
  • I'm familiar with that, but I've seen shared hosts where file perms can be set, and even HTML pages are inaccessible with a 700 permissions for example. (as far as I know, PHP wasn't handing .html files)
    – Trel
    Nov 14, 2016 at 17:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .