After reinstalling 15.1 I have a lot of problems with my permissions. I constantly have to adjust them manually. That means I'm doing it wrong.
Here is what I do:
I create a folder. The permissions are: Owner: Me, Group: Jos (I'm the only user). Both have create and delete files. With those settings Joomla doesn't remove the installation folder. After manually removing it I get the error message:
No configuration file found and no installation code available. Exiting...
Now I use the command:
sudo chown -R www-data:jos /var/www/html/my_site
Owner is now www-data
(create and delete) Group is jos
(create and delete). Installation works fine. Site works. But I can't do anything in it, as I am not the owner. www-data
is, and I have only Access Files permission.
I am using Lamp.
How do I set it correctly?
Your web user should not have write permission on your content, so to fix this what you should do is add yourself to the www-data group and then flip your chown command:
Then set your permissions to 2755 (directories) and 644 (files) or if you're wanting to be extra secure (or paranoid) 2750 and 640 respectively:
This will allow your user (jos) to have the write permissions on the content, and the www-data user to have the read permission that it needs. This is also a better security practice as prohibits the www-data user from modifying content thus limiting damage a potential attacker could do. One other thing to note here is that if joomla or some other program does need to modify content in the /var/www/html/my_site folder, I'd recommend manually adding the write permissions to those files/directories only.
Since I noticed you mentioned joomla here's a link to the source about their recommended permissions: https://docs.joomla.org/Verifying_permissions