User http does not have write permissions directory?

Posted by dwieeb on Server Fault See other posts from Server Fault or by dwieeb
Published on 2012-02-05T04:00:20Z Indexed on 2014/06/07 21:27 UTC
Read the original article Hit count: 280

Filed under:
|
|
|
|

I have a bit of an odd set up, I think. I have groups for each domain my server hosts, and I add the user http to each domain group along with the users that should have access to the groups' domains. In my php script running from a directory 'public_html', I try creating a file:

<?php
$output = "";
print exec('touch test 2>&1', $output);

But I get

touch: cannot touch `test': Permission denied

and the file is not created. But here, clearly stated, the group has all permissions on the directory:

drwxrwxr-x 5 dwieeb example.com 1024 Feb  4 05:19 public_html

And here are the permissions on the php file in public_html that is trying to use the exec function:

-rw-rw-r-- 1 dwieeb example.com   59 Feb  4 05:19 test.php

How is this possible if http is part of the example.com group (as seen from a cat on /etc/group) and the directory has full permissions for the group? ...

example.com:x:1000:dwieeb,http

I'm stumped.

EDIT (since apparently I'm not cool enough to answer my own questions yet):

Ah, I found the problem. Yes, I restarted Nginx, but the php-fpm daemon must be restarted as well when http is added to the group for my domain.

On Arch Linux:

rc.d restart php-fpm

© Server Fault or respective owner

Related posts about linux

Related posts about php