I've recently setup a new virtual server to host my websites. I'm pretty new to Linux based systems and sysadmin stuff and as a result have a few questions with regards to file and directory permissions.
My main site is located in /var/www and in there I have a directory where I keep a few PHP scripts, one of which contains the connection details to the database. What I'm looking to do is ensure that nobody has access to these scripts by visiting www.mydomain.co.uk/mydir but are still accessible to the www-data user so they can actually be called and executed from other pages on the site.
My initial thought is to change the permissions on the files to 400; however, I don't know what to do with regards to the permissions of the directory.
How do I change the permissions on the directory so that the files within it can be executed but not seen by people when they visit www.mydomain.co.uk/mydir?