0

My apache webserver runs as user www-data and is in the groups www-data, psaserv and psasb.

I have created a subscription in plesk. All files from all domains in this description are owned by user karl and group psacln.

I have logged in via ssh to my server and called a script as user root:root. The script created a file content.json also as root:root with access rights 644.

On my website, visitors are allowed to change the content of the file content.json through my website(a php script). However, the script returns failed to open stream: Permission denied.

I changed the user of content.json to karl:psacln and to my surprise, the script can now write to the file.

Why does my script has access to the file? Apache runs as user www-data not as karl. Read rights are only given to the user.

Your Answer

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

Browse other questions tagged or ask your own question.