Hi! Got an issue I couldn’t figure out
When I use /etc/fstab to automount an SMB share using CIFS, I cannot unmount it without root privileges. If I mount it manually (as a non-privileged user), everything works just fine.
Also, an application I mount the share for (Pika Backup, based on borg) cannot access backups unless I unmount the share with root privileges and then mount it back manually.
A respective line in /etc/fstab is: //address/directory /mnt/backup cifs credentials=…,user,auto,iocharset=utf8 0 2
Highlighted user option to make it clear I didn’t forget it.
Any advice?
Have you considered replacing
auto
withnoauto
, and creating a .desktop file in ~/.config/autostart/ to run the mount command when you log in?I do this, and it allows me to unmount as myself rather than as root.
Should work, though MentalEdge proposed a more elegant solution. All it took was setting uid in /etc/fstab.
Maybe it could help you, too?
Thanks anyway for your response!
I have a more complex setup than I described, making that approach a poor fit, but thanks for thinking of me. Glad you found a solution. :)
The option you’re looking for is users, not user.
user makes it so that any user can mount, but only the same user can unmount. Meaning, since root is mounting it on boot, root has to be the one to unmount it, too.
users allows any user to mount, and any user to unmount.
Not sure what’s on going with Pika. Who mounts the share shouldn’t matter, as the folder permissions should be the same regardless.
Do you have a uid option set?
It worked, you nailed it! So, the problem was that with automount it was root that was mounting, which ended up breaking permissions. As a result, I could not unmount the drive, and Pika couldn’t do backups. After setting the uid, it started to work properly as it began mounting under my name. As such, changing user to users was not required. But now I know the difference, so thank you anyway!
Case closed, and thank you again.
Ah. That’s right. You need to use the uid as the network share doesn’t have permissions the way a local partition would. Normally it’s unneeded, as the drive, folder and file permission are set on the drive, and those are the ones that matter once it is mounted.
Note that the uid only sets access permissions. It does not actually mount the share as you, so you’ll still need to be root to unmount it, unless you change user to users.