Permission denied when running a script
The x bit is missing: chmod +x script.sh. Or the file is on a noexec
partition (mount | grep noexec, see mount). Or the shebang is wrong.
Can't write to a directory, even though you have w on the file
Creating/deleting/renaming a file depends on permissions on the
directory (w+x), not on the file itself. Conversely, you can delete a
file with no permissions on it at all, as long as you have w on the
directory.
The web server can't read files (403)
nginx runs as www-data — it needs r on the files and x on every
directory along the path. namei -l /var/www/site/index.html shows
exactly where the permission is missing.
Access should work, but it doesn't
ACLs may be in play (a + in ls -l), or AppArmor
(look for apparmor ... DENIED in the journal). Classic permissions alone
don't tell the whole story.
An SGID directory: new files have the wrong group
SGID sets the group for new files, but existing ones and files moved in with mv
need chgrp -R by hand. Group write access comes from the creator's umask — see
Special permission bits.