Friday, February 13, 2009

Website Security - mass changing file and directory permissions

A Joomla install was giving me headaches (stupid "unable to connect to database" errors) yesterday. I ended up browsing the Joomla Forums in the meantime, went from install stuff --> install security --> website security stuff, and found some interesting info on file/folder permissions.

First, I ssh'd onto the server, went to the public_html directory, and did this:

  find . -type d -not -perm 755
  find . -type f -not -perm 644

I got facesmacked by a bunch of files/directories listed with not-so-happy permissions. I ran these to change them all.

  find . -type d -exec chmod 755 {} \;
  find . -type f -exec chmod 644 {} \;

Resource usage skyrocketed and it took a good 30 seconds or so, but it changed all the permissions. Joomla and Wordpress are still working.

I ran the first stuff again. Looks like phpBB creates sql junk in the temp folder with different permissions, but everything else was now fine. Time to start looking for a replacement for phpBB. Not only does it do a lot of stupid less-than-efficient stuff in MySQL, but this too.

One of these days I'll get to it....

No comments:

Post a Comment