Skip to content
Advertisement

Permission Denied when trying to read file w/644 permission

I am trying to write a PHP script for a Web server (lighttpd) to read a file in another user. The Web server runs under user http:

JavaScript

The file the script is trying to read has the following permissions:

JavaScript

Which I thought meant that any user can read it.

The fopen in the script results in a Permission denied:

JavaScript

I am running Arch Linux.

JavaScript

displays:

JavaScript

What permissions do I need to set on the file so that user http is allowed to read it?

By the way, am I correct in assuming I can also test the permission via:

JavaScript

Using the above command, the result is:

JavaScript

Advertisement

Answer

The permissions on the directory are probably wrong, http probably doesn’t have execute permission. Add world execute permissions:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement