Linux – How to create a symbolic link from one user directory to anothers

access-controllinuxsymlink

I have 3 users: admin with sudo, and two normal users – user1 and user2.

user2 is under user1 group.

There is a folder fold1 as /home/user1/fold1 which is under the group user1 with read and write permissions.

Now I want to create a symbolic link to this above folder at a location
/home/user2/fold1 so that user2 can access and write the same folder.

All I have been trying is the following from the admin user:

su admin
sudo ln -s /home/user1/fold1 /home/user2/fold1
sudo chown user1:user1 /home/user2/fold1

I have also tried sudo chown user2:user1 /home/user2/fold1, but not working.

But anyway, user2 cannot access this folder. Only a cross overlay is showing on the link from user2 account.

What could be wrong here?

Thanks in advance.

Best Answer

Since it is a soft link, user2 will have to have access to the whole path of /home/user1/fold1 with at least execution right (x).

(you should do a chmod g+x /home/user1)

Related Question