How to share a folder between two users on the same linux laptop
- Ubuntu 20.4 installed with user Marco
- created other user Polo by going to |settings > Users > Add User|
- created "commonDir" folder in Marco’s home directory. |right click > new folder|
- logged out from Marco. |click top right corner > power Off/Log Out > Log Out|
- logged into Polo
- navigated to Polo’s home directory but "commonDir" folder was not visible.
What should I do in order to make it accessible by both the users.?
(Still working my way through linux commands. That’s why I’m using UI to do all the things)
Should the commonDir folder be readable by both or writable by both?
If you want it to be readable by the other user:
Try $ cd ../Marco/commonDir
from Polo’s home directory.
With the GUI:
Go to Files, and click Other Locations. Click on home, then Polo, then commonDir.
If you want commonDir to be writeable, try as Marco:
$ sudo groupadd commonDir
$ sudo chgrp commonDir ~marco/commonDir
$ sudo usermod -a -G commonDir Polo
$ sudo chmod 775 ~marco/commonDir
Then as Polo:
$ newgrp commonDir
$ cd ~marco/commonDir
$ gnome-text-editor whatever_is_in_the_folder
Note: You have to do the above every time you want to write to things in the commonDir directory.