In my server (cpanel) I see now that with a simple DIR script (PHP) I can list files of all users over public_html
How can I prevent users from accessing the files of other users?
Your best bet, guessing that all users have different user id's, is to have their homes set to
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.
When you create a user, create a group also with the same name
groupadd mike useradd -g mike mike
and change group of all folders owned by user 'mike' to group 'mike'
chgrp -R mike /home/mike/
and make all user's umask value to 0[2|7]7 in /etc/bashrc, which will help to make these settings persistant for user accounts which will be created in future