News:

Wondering if this will always be free?  See why free is better.

Main Menu

chown bug when installing modifications

Started by vampi the frog, April 04, 2013, 03:44:09 PM

Previous topic - Next topic

vampi the frog

Hi guys. I've recently upgraded to SMF 2.0.4 by replacing all the files, restoring Settings.php and removing install.php. Not an issue, that worked fine.

Later, when I tried to install some modifications, I did a chmod a+rw -R *, and that gave all the files write permissions. Then, when I tried to install the mods, I received the success message, no errors, yet the files were unmodified. After a bit of hair pulling I figured out it was because the owner of the files was the local user instead of www-data, which afaik is the PHP user. So i did a chown -R www-data:www-data * and that make modification installation possible again.

The bug is that there was no warning for unmodified files. The resulting files (there was the backup file with the ~ at the end, and the new file with user www-data) were identical. So the least the modification installer code could do is check if the resulting files are identical, which they shouldn't.

Safe mode is off btw.

MrPhil

I doubt that will ever become part of the code. It would take running a file-compare against each and every "modified" file and its original (~ version), and the only time you'll run into this sort of thing is when your system is misconfigured. It's rare, and it shouldn't be SMF's responsibility to warn you about such a thing (filesystem integrity checks). If you have read-only (to PHP) files, I think you will get some sort of error anyway when PHP attempts to write to them.

It's not a bug in either SMF or chown, anyway. It's a misconfiguration. BTW, I hope this isn't on a shared server, as you would be opening up all sorts of security holes by giving everyone write permissions (666 or 777). Did you set them back to 644 when done? If you understand permissions, you can figure out what you need to give PHP write permissions to files and directories, which might be safer than 666/777 if there are other users sharing your system. If you need a refresher, I discuss this in my sig > FAQs > Proper Permissions.

Arantor


Advertisement: