Unable to mount CIFS share on boot with fstab in LinuxMint 19 [SOLVED]

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ladon

Unable to mount CIFS share on boot with fstab in LinuxMint 19 [SOLVED]

Post by ladon »

Hi All,

I installed Linux Mint 19 x64 Cinnamon (no update from a previous version).
I entered the following line in my fstab:

//<NasIP>/<share> /media/pictures cifs credentials=/home/<user>/.credentials,rw,uid=1000,gid=1000,nounix,vers=1.0,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

This line works perfectly fine on my very old Lubuntu Netbook Remix system.
In Linux Mint 19 it doesn't map the shares on boot.
When I select the share in my file manager I receive the following error:
"Unable to mount. Operation permitted for root only"

I tried this with a normal user as well as with an admin user.
If I enter "sudo mount -a", it maps all the shares correctly.

Maybe worth mentioning that "mount -a" returns only the message that only root can execute it.
However, this message is the same on my Lubuntu system. So I don't think that's connected with it.
The share itself resides on a very old QNAP NAS box (TS-109).

The file permissions for fstab are set to "read" to everyone.
Even when I add "write" to everyone, it doesn't change the behaviour.

Any thoughts about this are very much appreciated.
Many thanks in advance.

Kind Regards,
Andreas
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to mount CIFS share on boot with fstab in LinuxMint 19

Post by altair4 »

A couple of suggestions and it depends on why you want this share mounted at boot.

[1] If you want this to mount as required change your fstab mount to this:
//<NasIP>/<share> /media/pictures cifs credentials=/home/<user>/.credentials,rw,uid=1000,gid=1000,nounix,vers=1.0,iocharset=utf8,file_mode=0777,dir_mode=0777,user,noauto 0 0
Your share will not mount at boot or at login. It will mount when you select the "pictures" icon on the side panel of your file manager. Note: this will only work as described if your mount point is under /media ( which it is in your case ) or under your home directory ).

[1a] You can add the following to your Startup Applications ( Menu > Startup > Applications > + ):

Code: Select all

mount /media/pictures
Then it will mount at login not at boot.

[2] If you truly want it to mount at boot not "as required" or at login keep your fstab line as it is but:

** Create a new file at /etc/network/if-up.d/fstab
** With this content:

Code: Select all

#!/bin/sh
mount -a
** Make it executable:

Code: Select all

sudo chmod +x /etc/network/if-up.d/fstab
Something in if-up.d will run only after your network stack is operational on your Mint system which is why I suspect the orginal fstab line if not working.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
ladon

Re: Unable to mount CIFS share on boot with fstab in LinuxMint 19

Post by ladon »

Awesome!
That has solved my problem.
I added the "user,noauto" to the entries and that works perfectly fine.

Thank you very much for replying to that question and sharing your knowledge.
Very helpful indeed!

Kind Regards
Locked

Return to “Networking”