Linux – File ownership and permissions on web site PHP files

apache-2.2linuxpermissions

I am learning the basics of linux servers so I am green.

I have an Ubuntu server upon which there are websites that I have inherited.
In a fit of security worry I decided to check out the ownership of the web site files.

They are all 2016:sites.

If I run the command 'cat /etc/group | more' I can see that the group exists.
But when I run 'lastlog' the user 2016 does not appear.

I started to worry that 2016 might be the username of web users connecting from the web so I set the permissions on a testfile to chmod 600, giving read permissions to only the file owner. Sure enough I could still access the file from the web.

Can anyone suggest what is going on here?
I tried creating a new user and giving them file ownership but then when I access the file from the web it wants me to have all directories up stream owned by the same person.

Thanks

Best Answer

check your apache configurations, usually in /etc/apache2/ or /etc/httpd/ or /etc/apache, and look through the configuration for the directive User, if User is numeric 2016, that's just how it is set up.

do you know if the server is running with SELinux or any 'non-standard' configurations going on on it?

you can also do ps aux | grep apache (or grep httpd, mileage may vary), to see the user/userid that the service is running as. for example:

www-data 14549  0.0  1.0  23340  9864 ?        S    May17   0:00 /usr/sbin/apache2 -k start

shows me www-data is the user running apache2 on my site.

let us know what you find out.