I am a beginner in server management.
I am using the class.upload.php library so that users can upload files from my website. To this, I give a full path like: uploads/gifs/90/x.gif This path does not exist on my server but I want to create it.
My php log returns me: PHP Warning: mkdir (): Permission denied
If on my server as root user I create the uploads folder with 777
permissions, the library creates the rest of the path correctly when uploading a file.
User apache owns gifs/90/x.gif
From the above, I believe that the apache user does not have write permissions on the html folder.
In etc/groups I have seen that the apache belongs to the group:
nagcmd: x: 503: nagios, apache
The web folder on the server has the following permissions:
drwxr-xr-x 32 root root 4096 Feb 4 17:20 html
I want the library to be able to automatically create directories in the html folder. What is the best way to do it?
Assign write permissions to others in html /:
drwxr-xr-wx 32 root root 4096 Feb 4 17:20 html
Give permissions only to the nagcmd group so that it can write to html/ (I don't know how to do this)
Others
I don't want to compromise the security of the web.
Thank you very much in advance
html/
to the apache user (which should be calledwww-data
?). Also,chmod 777
is never correct and is a potential security risk.html
folder immutable (not-writable). And putting logs in a different location.moustache
is good. It is well defined (is not full of gotchas), it separates concerns (code logic is separate from template), is easier to use (for both novices, and experts).html/
folder and it works fine.