Mounting smb shares with permissions for other users

Hi,

I followed every piece of advice I could find on this forum, and I sill can’t make it.
I want to:

  • mount a disk being shared by my router via smb automatically at restart

I manage to mount it and unmount it as osmc - manually. But I can’t seem to have it automatically mounted after restarting the Pi.

Here’s my fstab:

//share/folder /home/osmc/videos cifs noauto,uid=1000,gid=1000,noperm,rw,sec=ntlmv2,user=myuser,pass=mypass,users,nobrl,file_mode=0777,dir_mode=0777,nounix,iocharset=utf8 0 0

I tried the x-systemd.automount, but fstab doesn’t seem to like it - I always get an “invalid argument” when using it (testing manually)

I’d appreciate any help with this.

Cheers,

Francis

You have set the option noauto in the mount istruction in your fstab file.

This will stop it automatically mounting. Try removing this option and rebooting.

I tried that, no luck…

Try using the IP address.

Can you reboot and then post the output of dmesg, journalctl and systemctl status smbd on the OSMC pastebin and link them here?

Did you actually try adding it in fstab or did you only test it on the command line ?

x-systemd.automount won’t work on a mount command line as its not an actual file system mount option. It is a systemd option which is read from fstab. It doesn’t get passed to the underlying file system but instead signals systemd to create an automount unit for the mount point.

@oculos, just to help out a bit with understanding as I also got myself confused with the “invalid argument” issue.

  1. As @DBMandrake wrote initiating the mount manually with mount /mountpoint will throw out the error as it is not designed for that.

  2. This should be your line in fstab //<IP of Server>/<share name>/ /mnt/<mountpoint> cifs noauto,x-systemd.automount,iocharset=utf8,user,username=<username>,password=<password>,uid=osmc,gid=osmc,iocharset=utf8,file_mode=0770,dir_mode=0770 0 0

  3. After you entered the line in fstab and you reboot if you just call mount you will not see the drive being mounted. That only will happen once a file operation is executed on the that filesystem e.g by ls /mnt/<mountpoint>

3 Likes

Thanks a lot @fzinken - it worked! Indeed, I was expecting it to show already when I reboot, but it didn’t. Then I followed your advice and performed a file operation, and BOOM, there it was! :slight_smile: And I didn’t even need the ip address.