File permissions - who owns the group publicly accessible on the web server

I read a lot of file resolution guides, but all they say is, for example, "if you do not want others to write your files, set it to xxx ..."
but in web hosting, who really is? there is only a web server (apache) and php and mysql and other programs. no "other users". the tutorials said apache was considered "publicly available." but I have php scripts that get the downloaded file and put it in the "downloads" directory. I set the rights to 744 directories for this. This means that the group and the public must be able to read, and the owner has full access. I expected that my uploaded file would not be transferred to this directory due to the lack of a “record” for “public”. but the file was there. and more confusing for me was when I tried to upload a file, I got a “forbidden” error. I expected that I could download the file because the public had permission to read.

+4
source share
1 answer

The user in this case is the web server itself. Typically, Apache works as the user "apache" or "www-data" when it reads and writes files to the server file system. Static content must be readable by the server. Place of publication must be writable. Depending on the other users on the system, you may consider the web server a “different” user and the webmaster account the actual owner of the file.

+1
source

Source: https://habr.com/ru/post/1439672/


All Articles