0

This question already has an answer here:

I have two users with home directories:

/home/user1/
/home/user2/

I would like to share a folder between the two users:

/home/user1/some/path/to/folder

but would only like user2 to have access to /home/user1/some/path/to/folder and not any of the parent directories. I tried to chmod 777 /home/user1/some/path/to/folder, but that didn't work.

marked as duplicate by DarkHeart, Stephen Harris, Shadur, Mr Shunz, Michael Homer Dec 21 '18 at 3:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.