Macos – How to prevent others from seeing the contents of the home directory, except for the public folder

macospermissions

On Mac OS X, it's relatively easy to prevent people from seeing the files contained in your home directory: chmod 700 ~

I'd like to perform a variation of that. I want it so that when people open /Users/stalepretzel, they only see one folder listed: Public. From there, I'd like to set the permissions of Public so that people can enter that folder and read anything that's not specified otherwise.

Again, to clarify, I'd like it so another non-admin user could execute:

$ cd /Users/stalepretzel; ls
Public
$ cd Public
All     the     contents     of
my      public  folder

Best Answer

I'm afraid this isn't possible. A user can't access any file or folder anywhere in the tree of a directory for which he doesn't have read permissions. If the user does have read permissions for a directory (and all its superdirectories), he can ls and see all the files it contains.

It might not feel quite so tidy, but if you want to prevent users from being able to ls your home directory you'll have to create Public somewhere outside of ~. If it's easier for you to access your own public directory from ~/Public, make a symlink (e.g. ln -s ~/Public /Users/Shared/stalepretzel).

Related Question