What should be the ideal home directory permissions in linux
I think the best permission would be
711 if you dont want to add groups as well or
751 so that public can't read your home directory
with 755 public can read which other users are on you home directory
Between 751 and 750, it should be noted that 751 can be used to allow access to a subdirectory of your home directory.
One place you might use this is when enabling the Userdir mod for the Apache web server -- it allows you to give each user their own web-browseable directory, under a common name such as public_html
. For example, a URL like http://<hostname>/~<username>
can be automatically served up from /home/<username>/public_html/
. But to do that, Apache needs to have sufficient permissions within your home directory to at least read files in a folder under it.
Setting a directory to 751
allows it to be navigated to (by anyone) without being read. This, in turn, is required to allow the username that Apache runs under to get 'through' your home directory to the public_html
within it.
This is useful, in my experience, primarily for web development on a local machine, though I've seen it in action not uncommonly with educational institutions.
The default would usually be 0755.
I guess 0751 would also work, if you for some reason don't want the content to be publicly browsable.
(of course, owned by root:root)