Prevent access to files of other users [closed]

In my server (cpanel) I see now that with a simple DIR script (PHP) I can list files of all users over public_html

/home/[user]/public_html/

How can I prevent users from accessing the files of other users?


Solution 1:

Your best bet, guessing that all users have different user id's, is to have their homes set to 0711 that is, readable, writable and executable to them, and only executable to others.

For a directory, the executable bit means that you can go in it but you can't list the content, which is what you're looking for.