Linux – Is chmod 700 on a directory sufficient to prevent arbitrary access to subdirectories

chmodlinuxSecurity

If I chmod 700 the the home directory of a user (on Linux), does this guarantee that other non-privileged users cannot access any subdirectory or file under that home directory? Or are there sneaky exceptions to this?

Just to be concrete, if I have a directory /home/foo that is 700, and it has a subdirectory "bar" that is 777, can any other user on the system read bar? Or is it guaranteed not to be readable?

Best Answer

Yes. In order for another user to traverse into any subdirectories, it needs to read the base directory. If it doesn't have permissions (ie: 700), it won't be able to read anything in there. Also make sure that the base directory (/home/foo) is owned by the user foo. A user, bar, should not be able to access it.