These are the permission for my www folder:
drwxr-xr-x 18 root root 4096 Jul 16 00:21 www
Are they correct? I'm wondering: Why does it have to be an x (for execute) in there, isn't that risky? When I try to set them to remove the execute flag for others, my web server is not able to load any files anymore:
chmod o-x www
Am I doing it correctly or would I need to change something?
On directories
execute
permission grants the ability to traverse the directory. A directory withoutx
cannot be examined, which explains why the web server cannot see the files.For a directory, x means 'see the contents of the dir' not 'execute any files in that dir'. Only the x on a regular file means 'execute'. Isn't this one for the sysadmin board though?
x for directories mean "permission to access the directory contens". Note that it is different from the r bit which grants the permission to view the contents. If you know the file path, you don't need the right to read its parent directory, but you need the right to traverse it (all parents of the file, actually).
x on directory means that it can be accessed, and each file and folder in it can be "accessed" but the folder cannot be listed, i.e. you can't see it's content.