I have several folders:
/home/user1/ -u user1 -G user1
/home/user2/ -u user2 -G user2
/home/user3/ -u user3 -G user3
I created three users user1, user2, user3. Each user has their own group. Any user can see other account folder for a while but cannot open it.
After user2 logged in using ssh they shouldn't see any folders downto its folder /home/user2/
.
They should see only folders in /home/user2/
.
How to set these permissions?
Best Answer
If you use
chmod
to set only set the x bit forgroup
andother
on /home - This disallows reading/home
(ls
will fail on /home), but thex
bit allows traversal to known sub-directories.And also set no access for
group
andother
on sub-directories in/home
ie the user directories.If you are the user root, the commands would be:
Then user2 will only be able to see the files in user2's home directory and
ls
on /home, /home/user1 and /home/user3 will fail; ls: cannot open directory 'directory-name': Permission denied