It might look all that simple, but it took me a while to figure out. The following command looks for directories and sets the permission to 777. First you need to ch into the directory and change them from there.
find . -type d -exec chmod 777 \{\} \;
If you’re installing SugarCRM you are required to set the entire directories as well as files under modules directory to writable. Go on now.