Shared HDD partition

Resolved

EDIT: Thank you guys! fstab did it. And it works perfectly! Thank you again

Hello fellas!

I‘m on Manjaro 19 KDE. And I came across a problem where I couldn‘t find a solution. So my last hope is seeking for an answer here.

On my system I have 2 drives. 1 SSD for the OS and 1 HDD for data. My system has 2 users that need permanent access to the data drive.

I have created a group where both accounts are added. And this group owns the drive permissions, so only we get to access it.

My problem is, that the drive is mounted by the logged im user. And when I log out and switch the users, I have to unmount the drive and remount it, so I can access it. When the drive is not unmounted I get the message that says drive /run/media/user1/drive no no permissions (or something similar)

I‘d like to automate it so when I log out the mount gets ejected and when I log in with a different user it gets mounted. Or if it‘s possible to have it mounted for both users all time.

Thank you in advance

-kraapi

Posted Apr 7, 2020, 12:37 AM UTC · edited

16
Genrawir•

Set it to mount at boot by adding an entry to your /etc/fstab file. The syntax will depend on your mount point and filesystem. This will not automatically unmount it when you log off your user, but since presumably the other user may want it afterwards I don't know if your really want to do that anyway unless you have an unusual use case.

3
kraapiOP•

That‘s exactly what I need! Thank you! The special use case is that on the drive where the data is stored there is the cloud directory that is synced locally on the PC and is needed by both users at any time

1
SirCarrington•

Use the gid=xxxx flag in your mount command or fstab (however you're mounting the drive). 'xxxx' should be the number of the group you made for sharing the drive.

3
lutusp•

My problem is, that the drive is mounted by the logged im user.

The solution is to mount the drive in /etc/fstab, not in a user's configuration.

2
kasak730•

Create an automount entry in your fstab. Great utility called genfstab which can do this for you. If im not mistaken, its in the arch-install-scripts. Or, just manually add the entry yourself.

2
Koylio•

If for some reason the fstab solution isn't working for you, another but bit more complicated option is autofs.

https://wiki.archlinux.org/index.php/Autofs

2