Samba: On Demand CIFS Mounting of Shares

Write tutorials here
There are more tutorials here
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Level 1
Level 1
Posts: 1
Joined: Sun Feb 17, 2019 1:00 pm

Re: Samba: On Demand CIFS Mounting of Shares

Post by Gotit »

Hi and thanks for the tutorial!
I have the mount on demand working like a charm, switching to "/media" instead of "/mnt" was the secret sauce for me. However, the FS doesn't umount with my user.
*** When you are done using it you can use the little mount icon next to the name to unmount it if there is one for your desktop or right click it to unmount it.
I have to use sudo it in the terminal to make umount successful. My user gets

Code: Select all

umount: /media/N-Media: umount failed: Operation not permitted.
The mount point folder is owned by root until I mount my desired FS and then ownership is given to me.
My fstab entry is:

Code: Select all

// /media/N-Media cifs guest,vers=1.0,noauto,x-systemd.automount,x-systemd.idle-timeout=1min,_netdev,user,uid=1000,iocharset=utf8,sec=ntlm 0 0
I'm running with systemd hence the x-systemd options. I've tried without the timeout option too, but it makes no difference.
Right click > unmount in Thunar doesn't seem to work.

Level 20
Level 20
Posts: 10051
Joined: Tue Feb 03, 2009 10:27 am

Re: Samba: On Demand CIFS Mounting of Shares

Post by altair4 »

My HowTo is not about a systemd style automount so none of these options x-systemd.automount,x-systemd.idle-timeout=1min would be applicable. The netdev option would also not be applicable although it probably will do no harm because the share is not being mounted at boot.

The reason you can't unmount it as a regular user is because systemd doesn't understand the concept of an old style AutoFS mount so it's mounting the share automatically despite the noauto and the only user present at boot is root..

This HowTO uses a different method to mount.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

Level 1
Level 1
Posts: 1
Joined: Mon Feb 18, 2019 6:12 am
Location: UK

Re: Samba: On Demand CIFS Mounting of Shares

Post by cas1701 »


I have to say thank you so much for your brilliant HowTo. I’m a recent arrival to the world of Linux and have a NAS, which I used easily and successfully in Windows 7. I spent much time trying to find out how to mount the shares from my NAS onto my new Linux installation and seemed to be frustrated at every turn.

Then I found this. Simplicity in itself, bravo sir.

Post Reply

Return to “Tutorials”