My PHP script create a ssh key pair and safe (file_put_contents) it to /home/pi/.ssh/.
This script works fine from command line.
But executing it from website (as www-data user) fails:
"Warning: file_put_contents(/home/pi/.ssh/...
) failed to open stream: Permission denied".
I don't want to change files group or owner. (i tried for tests and it works).
I don't want to use an extra scipt for this file editing.
I saw this question: allow php files to write to locations other than those owned by www-data This solution is not what i was looking for.
I tried to add the path (/home/pi/.ssh/
) and path+filname to /etc/sudoers
.
This not working. It seems that sudoers is for executable files only?!
I would wish a solution like an entry in /etc/sudoers
.
Because there will be some more files "outside the webserver" that needed to edit from website.
So please tell me, is there another easy option?