Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a daemonized service that generates content at /usr/share/service/content

I need this content to be accessible from PHP.

The service runs under a user named _service which belongs to the same group as the one running PHP (www-data). Both service and content directories are owned by www-data, and has group write permissions enabled, which I assumed it should suffice.

The service's content is being generated but not stored/written in/to content.

If I make the service to run under the www-data user it does write the content, and it's accessible from PHP.

What part of my assumption is wrong?

Also, what are the implications of having a folder outside /srv/... being accessible to the www-data user?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I would start troubleshooting with:

su - _service
ls -la /usr/share/service        # test rx permissions on the parent
echo > /usr/share/service/content/delete_me
cd /usr/share/service/content    # test x permission
rm delete_me
env
exit

su - www-data
env
exit

More advanced:

su - _service -c "strace /my/path/to/service -options -options"

share|improve this answer
    
ok, _service cannot create /content/delete_me: Directory nonexistent but can cd into content and rm existent files in that directory. Also, it can nano eraseme.txt and will create the file. –  goliatone Dec 6 '11 at 12:40
    
su - _service "ls -la /usr/share/service" # test rx permissions on the parent –  kubanczyk Dec 6 '11 at 17:37
    
Done, output: -su: Can't open ls -la /usr/share/service –  goliatone Dec 6 '11 at 19:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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