Usually it's file ownership and not file permissions I find.
File permissions I use:
find . -type f \-exec chmod 644 {} \;
find . -type d \-exec chmod 755 {} \;
find . -type f -name "*.php" \-exec chmod 600 {} \;
chmod 600 app/etc/*.xml
chmod u+x bin/magento
Different hosts though may have slightly different specs, first lines file permission 664 and 775 may be fine too. Avoid 777/666 like the plague! Lines 3 and 4 tighten it up a little.
Check what user:group owns the files, run on the folder containing the magento installation:
ls -la
results will show you file permissions, user and group along with other info, including the user and group of the magento installation folder itself (file listed as . at the top).
Use below to change the user:group as required (if in doubt, consult host):
chown -R user:group .
As others have said, refer to your Magento versions documentation.
If you still problems, you are likely going to need to consult your host, the tracing goes on deep, run below in the Magento install folder which checks which user is running apache processes, if you've got this far, it's likely to give you a clue and your host if something's out
ps -ef | egrep '(httpd|apache2|apache)' | grep -v `whoami` | grep -v root | head -n1 | awk '{print $1}'
Usually its the same user as the folder above magento's install, but at this stage it's really hosting environment dependant, dig into stack exchange https://serverfault.com/! I've had sleepless nights on Magento 2 permissions and ownership, hate it, I do hope they introduce a more friendly solution to this persistent problem not common on many other platforms.
var/cache
andpub/static
need suid bits set. I used:find var/cache -type d -print0 | xargs -0 sudo chmod 1775