The /home
directory has the execute permission set for everyone so that users can move into their homes inside but each user's home only has permissions for the user (unless configured otherwise for some reason).
The only way to get exactly what you want is by creating a group containing user2
and giving it execute permissions for home of user1
and the directories above the one that you want to share to make them traversable by user2
and then set the full permissions on the full directory. I would not recommend doing this as user2
would be able to ls specific files and subdirectories inside of the home of user1
which is a bad idea. You don't want to give another user permissions to someone else's home.
A better way to accomplish this would be to either make a directory in /
and create a group containing the users and give them permissions to it or to create an nfs export with permissions for the two users only and mount it on the machine. Once again, do not give another user access to someone else's home.
sshfs
to create a "virtual" directory accessible by both users. – porton Dec 19 '18 at 22:28