Mounting disk drives among different users
- Will it work? The answer depends on how the permissions are set on the folder. No matter if it's linked or not, if the user is not privileged to access the directory, the user will not be able to.
- Is this safe? It's safe if it does work, but you probably want to do this the correct way.......
How to mount a device so that other users have access to it:
First, with the device unmounted, make an entry for the device on a new line in /etc/fstab
, making sure that there is still a final new line at the end of the file. It should look something like:
UUID=<uuid> /media/<mountpoint> ext4 user,defaults 0 1
Or:
/dev/XYZ /media/<mountpoint> ext4 user,defaults 0 1
Replace <uuid>
with the UUID of the drive, <mountpoint>
with the directory under /media
that you want it to mount in, and /dev/XYZ
to the device's name.
Second, make a new group and add the two users to it with:
sudo groupadd <group name>
sudo adduser <user1> <group name>
sudo adduser <user2> <group name>
Then make sure the mountpoint is owned by the group:
sudo chgrp -hR /media/<mountpoint> <group name>
Mount the drive with sudo mount /dev/XYZ
or reboot.
This method will avoid messing around with symbolic links!
Related videos on Youtube
Comments
-
ike over 1 year
I had this idea about mounting disk drives among different users. I would create a folder called say /media/diskXYZ . Then I would make a softlink from /media/user1/diskXYZ to /media/diskXYZ , and from /media/user2/diskXYZ to /media/diskXYZ . The intention is that two users can have the disk mounted at the same time, and programs that have a folder name hardwired in will work whichever user mounted it. I didn't want to do it because I wasn't sure if it was safe.
- Will it work?
- Is this safe?
-
Richard over 10 yearspossible duplicate of how to mount extended partition in ubuntu for all users
-
Richard over 10 yearsIt gives an answer that is not too detailed...
-
benjamin10 about 6 yearsPerfect answer! Just one small correction: In my case it is not:
sudo chgrp -hR /media/<mountpoint> <group name>
But:sudo chgrp -hR <group name> /media/<mountpoint>
Thanks for the cool description! -
Admin about 2 yearsI don't know why, but for me
sudo chgrp -hR /media/<mountpoint> <group name>
did not work. However, using the GUI did. That means right click on/media/<mountpoint>
, selectproperties
and adjust the entries forgroup
andaccess
.