This posting is something I had put on my server at some point:
I maintain a multi-user Linux server and the users can put content up on this server under their own public_html folders.
I set up a script so users could password protect their folders from the web, which worked but other local users could still see each others work when they logged in locally via ssh.
I found that by setting the permissions for public_html to 750 I could protect their work from other local users. To allow Apache to still see into their folders I added the apache group (www-data on my system) as the group owner of the public_html folder.
Fortunately, you can use wildcards for directory names in Linux.
So in the end it was a simple as doing the following (as root user):
~$ chmod 750 /home/*/public_html
~$ chown :www-data /home/*/public_html