There are two accounts user1
and user2
. I wish to share and give rwx access to my user1
/home/user1/Documents/ folder with user2
. To do this, I have made a new group called sharedDocs
. These are the commands I executed in order:
groupadd sharedDocs
usermod -aG share user1
usermod -aG share user2
chgrp -R sharedDocs /home/user1/Documents
sudo chmod -R g+rwX /home/user1/Documents
From here, I switch to user2 to access the documents. su
to reload.
su user2
user2: touch 1.txt
This command works, if prior to su
I was in the /home/user1/Documents
folder. However, the following commands don't work, and I cannot return to the directory once I left it.
user2: touch /home/user1/Documents/1.txt
touch: cannot touch '/home/user1/Documents/1.txt': Permission denied
user2: cd /home/user1/Documents/
bash: cd: /home/user1/Documents: Permission denied
I have followed these two guides: