How To Fix File Permissions for Joomla

Yesterday Geni came to me with an interesting problem: He needed to update user pictures, but was unable to place them inside the member_pics folder. This was because the member_pics folder was a folder that had been created by a user via ssh, not by using joomla. The permissions on the folder were 775, so a non-owner non-group user could only read and execute from the folder.


There are two solutions to the problem. Technically three, but third is illogical:

Get someone with admin access to to go to labsite/images/stories. That’s where the member_pics folder is. When there you have your options.

1. change the owner and group of member_pics to be www-data. That’s the proper owner and groupname that joomla uses. for those uninitiated, that means doing something like this: chown www-data:www-data member_pics. Problem solved!

2. If for some reason you don’t want joomla to own that folder, but want it to be read-write-accessible by joomla, you can instead use chmod. The syntax for chmod is chmod permission target . the format for permission is a three digit number corresponding to owner, group, and all others. each single digit is a decimal representation of the binary permissions.

7 -> 111 in binary. The first digit is the read permission. second digit is write permission, third digit is execute permission. A one means that permission is enabled. given that the current permissions were 775, 5->101. Therefore all non-owner, non-group users were able to read, execute, but not write to that folder.

A 7 in any spot means the category can read, write, and execute any files in the folder. 777 means everyone can do everything to that folder and its contents. Since we specifically do not want joomla owning this folder, all that matters is the last digit. Have your admin do a chmod xx7 member_pics where xx are the already-existing preferences (you can see them by doing ls -l).

3. Add joomla to the group that owns the folder. This is really illogical, but you COULD do it. I actually don’t even know how to specifically do it. I’ve done it in the past. You would use usermod -g to do it, I believe. Either way, that user would now benefit from the second group of privileges you see when you ls -l, which at the time was 7. So that would solve the problem too.

I went with choice number 1. Joomla owns the folder, Geni got his work done, the world keeps turning.