Thursday, January 3, 2008

Community Housing Network, permissions, and NoMonthlyFees.com

Worked on CHN's site tonight. We had run into a problem in that suddenly the server on NoMonthlyFees (CHN's hosting service) wasn't behaving properly. It turned out that the server which used to run as userid "communit" was now running as "nobody". This was causing a problem because the server needed to be able to write to a particular directory and it couldn't because "communit" owned it.

We had some other systems running under the CGI directory which also counted on running as communit, so I needed to address the situation immediately. NoMonthlyFees support folks insisted that this was as it had always been (couldn't be as our system has been running fine up until the past few weeks).

I solved the problem by creating a script which would create a copy of the directory in question.

First, using my FTP client, I moved the current directory to a new location. I then set the permissions on the parent directory to 777 (chmod 777) -- a security risk, I know, but it was only open for the duration of this process. Then I ran the script which created the new directory and copied the contents of the original directory:

mkdir ourstuff
cp -r ourstuff.old/* ourstuff/.

Then all I had to do was reset the permissions (chmod 755) on the parent directory and delete the script.

Ironically, in the process of trying to repair the systems running out of the CGI directory (HomeShare and Empowerment links), I discovered that scripts running under CGI do run as "communit", so I actually didn't need to do anything.

Why would NoMonthlyFees run PHP scripts as "nobody" and CGI scripts as "communit"? I have no clue, but I'm not going to point it out to them as it will only lead to trouble.

Intro for the Curious

This is a blog for me. If anyone else wants to read it, please feel free. My main purpose is to record technical issues I run into when I am working on a client's system and any steps I have to take to solve them.