I'm going to be hosting open shells on my machine. Therefore yes, any directory with 777 permissions would be an extremely potent vulnerability.
Anyways I found the answer to the question;
http://stackoverflow.com/questions/9133 ... ermissions
It involves using chown and chmod to set the owner of the directories as www-data, which is, as stated above, the user that PHP runs under.
sudo chown www-data store/
sudo chown www-data cache/
sudo chown www-data files/
sudo chwon www-data images/avatars/upload/
sudo chmod 700 store/
sudo chmod 700 cache/
sudo chmod 700 files/
sudo chmod 700 images/avatars/upload/
You can change the other permissions to the directories if you want using...
sudo chmod 7xx directory/
...but I highly reccomend that the second and third number NOT be 7 (full read/write/execute). Read is just fine, which is 4 in chmod.
So it would be either...
sudo chmod 700 directory/
sudo chmod 744 directory/