I had this issue when trying to get WordPress to create anything on my server. A lot of what I read was to CHMOD to 777 or what have you. That still didn’t work, and it is a security issue anyway.
What worked for me, is making sure the owner (CHOWN) of the files is correct. I couldn’t tell you off hand what that should be in your set up because – it really depends. On a default Ubuntu 10.4 running Apache 2.2.16, for example, the owner should be “www-data” and I put that as the group as well. In my case there was no need to alter permissions at all.
From the shell, the command would be
#sudo chown www-data:ww-data /var/www -R
There may be command line tool to set all folders and files back to default permissions as well. I have used such things in the past…
Hope this helps somebody!