I have created an SSH user on our system, fred
, whose home directory is /home/fred
and who has a subdirectory at /home/fred/someFolder
. I am trying to allow PHP/Apache, which is running as nobody
, to be able to create a file inside fred's someFolder
directory. No matter what I try, I always get Warning: file_put_contents(/home/fred/someFolder/test.txt) [function.file-put-contents]: failed to open stream: Permission denied in /home/websiteDir/public_html/test.php on line 1
I have tried several different ways of doing this and nothing seems to work so far. Tried to chmod the folder to 777, 666, 660, etc. Tried chown with fred:nobody, nobody:fred, nobody:nobody, fred:fred, still nothing. Tried adding fred to nobody's group, tried adding nobody to fred's group, nada.
Sorry, I'm not all that great at linux… any advice would be appreciated.
Best Answer
All parent directories of /home/fred/someFolder must have the execute bit set for the user/group accessing it. So most likely /home/fred is missing this.
chmod a+x /home/fred