Can't auto mount smb remote folder with fstab as non-root user

I can access a remote smb folder though smb://dataserver, I added a network point in Dolphin, I can read/write to the remote folder - no problem. But I can’t auto mount it on my local machine with fstab as a non-root user:

//dataserver/Data\040Server    /mnt/dataserver  cifs    rw,auto,username=myusername,password=mypassword,uid=1000,gid=1000,file_mode=0770,dir_mode=0777,iocharset=utf8,users   0   0

It says:

An error occurred while accessing 'Data Server:/mnt/dataserver on dataserver', the system responded: This program is not installed setuid root -  "user" CIFS mounts not supported.

Without the ‘users’ option it complains that a non-root can’t mount it. I need it mounted for doing backups (backups only work on mounted folders).

What am I missing?

Remove the ‘users’ option.

More info

man mount.cifs

https://www.swerdna.net.au/susesambacifs.html

As I said, I’ve tried it without the ‘user’ but it fails and says it can only be mounted by root. Here’s what I have:

//dataserver/Data\040Server    /mnt/dataserver  cifs    noauto,credentials=/home/linuxoid/.smbcredentials,uid=1000,gid=1000,file_mode=0700,dir_mode=0700,iocharset=utf8,_netdev   0   0

I’ve checked that with a root - all is fine, it mounts and unmounts fine. But not as a user. How can I mount it as a user in Dolphin?

Dolphin accesses such shares via libsmbclient (in an ftp-like manner), so not mounted as such. Nevertheless, you should be able to access using something like ‘smb://<hostname>/share’ in the location bar.

Can you show what is reported by attempting the mount manually?

sudo mount -t cifs....

For example, I can mount a remote Windows share I have at hand using similar options to those you’re using…

sudo mount -t cifs //deanm.local/Downloads   /mnt/test -o  rw,auto,username=myusername,password=mypassword,uid=1000,gid=100,file_mode=0770,dir_mode=0777,iocharset=utf8
> ls -l /mnt/test     
total 15503373
-rwxrwx--- 1 dean users      91205 Feb 17  2020 0216231052_Testing_1.kmz
-rwxrwx--- 1 dean users      68414 Feb 17  2020 0216233508_Testing_2.kmz
-rwxrwx--- 1 dean users      68414 Feb 17  2020 0216233508_Testing_3.kmz
-rwxrwx--- 1 dean users    [1244666](tel:1244666) Mar 18  2020 1800-24G-InstGde-May2006-59914724.pdf
-rwxrwx--- 1 dean users     633617 Mar 18  2020 1800-MgtCfgGde-Oct2006-59914726.pdf
.
.
.

The mount command reports the mounted filesystem like this…

//deanm.local/Downloads on /mnt/test type cifs (rw,relatime,vers=3.1.1,cache=strict,username=myusername,uid=1000,forceuid,gid=100,forcegid,addr=172.20.10.3,file_mode=0770,dir_mode=0777,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)

I’m not quite sure what is failing for you.

This program is not installed setuid root

The suid bit is not set for mount.cifs for security reasons.
So you can not mount it as user.

I have to admit that i have never tried to use a backslash in a fstab path name “//dataserver/Data****040Server”. Are you sure that is going to work?

Regards

susejunky

No, and there should be no need to. The mounting is done as root (even when permissions are set for r/w access for given users).

I see someone has already given up before:
https://forums.opensuse.org/showthread.php/476042-Mounting-NAS-fstab-mount-failed/page4

I’ve read some set the suid thing in other distros, but it’s not recommended here. Some say the ‘user’ option is working in other distros - why not in openSUSE?

So do I understand you right that remote smb folders cannot be mounted by non-root in Dolphin in openSUSE? It can mount local harddrives as non-root but not remote ones?

And really no easy way around this?

@susejunky](https://forums.opensuse.org/member.php/86946-susejunky), yes, the backslash is working fine, mounting as root is no problem, no errors.

So do I understand you right that remote smb folders cannot be mounted by non-root in Dolphin in openSUSE? It can mount local harddrives as non-root but not remote ones?

You appear a bit confused here. Dolphin doesn’t do any mounting of any file-systems by itself, but can navigate/view mounted file-systems remote or otherwise. It can also make use of KIO slaves (supporting KDE libraries) to access filesystems via protocols such as SMB, FTP, SFTP etc. When you access a remote share using ‘smb://…’ in Dolphin, you’re utilizing libsmbclient under the hood (and no mounting is done via this method).

Well then, here’s what I need to do: I want to synchronize my local folder with the remote folder on another computer (running the Samba server) with the Lucky Backup program. This only works with mounted folders, it doesn’t work over the network shares. The folder has to be mounted on demand, that is when the server is on and when the folder is accessed, for example from Dolphin or Lucky Backup.

  1. How can I run the Lucky Backup with mounting the remote folder?
  2. Or is there any other similar GUI backup program in openSUSE which can sync remote non-mounted folders?

Perhaps systemd auto-mounting will work for you here? Use a mount-point in the user’s home directory?
https://wiki.archlinux.org/index.php/fstab#Automount_with_systemd

For example

//dataserver/Data\040Server /home/linuxoid/dataserver  cifs credentials=/home/linuxoid/.smbcredentials,uid=1000,gid=1000,file_mode=0700,dir_mode=0700,iocharset=utf8,noauto,x-systemd.automount,x-systemd.mount-timeout=30,x-systemd.idle-timeout=30    0  0

BTW, I note that you have specified gid=1000 (is that group actually assigned)?

cat /etc/group | grep 1000

No, that systemd still fails:

An error occurred while accessing 'Data Server:/mnt/dataserver on dataserver', the system responded: mount: /mnt/dataserver: **operation permitted for root only**.


Yes, that gid=1000 is set for accessing the Data Server over smb://dataserver and to maintain all file/folder originator as that user. My username belongs to that group. This is not a problem for file browsing in Dolphin. But the rsync can’t backup files over this, it only works on mounted folders - and this is the problem. Well, an awful inconvenience, not a problem. But Vindoze can do that, why can’t Linux?

Can you please create and change the mount-point to /home/linuxoid/dataserver, and try again. You shouldn’t need to invoke any mount command manually. Just navigate to /home/linuxoid/dataserver with Dolphin, and the share should be mounted (on demand) and visible.

This just works for me…

//deanm.local/backup /home/dean/backup cifs gid=100,uid=1000,username=a,password=b,noauto,x-systemd.automount,x-systemd.mount-timeout=30,x-systemd.idle-timeout=30  0  0

No. Same thing when I click on the Remote Folder in Dolphin:

An error occurred while accessing 'Data Server:/home/linuxoid/Dataserver on dataserver', the system responded: mount: /home/linuxoid/Dataserver: operation permitted for root only.

If I simply go to the Dataserver folder in Dolphin, it’s empty.

I suspect this is because you have setuid root on mount.cifs (and this should not be done).

Show

ls -l /sbin/mount.cifs

# ls -l /sbin/mount.cifs
-rwxr-xr-x 1 root root 39752 May 17  2020 /sbin/mount.cifs

Hmmm…I get the same message if I attempt to view the remote folder (shown as a mount point in ‘Remote’).

If I refresh (F5 or via Dolphin menu) first, then it does work without error.

If I navigate to the mount point, or via the ‘Places’ shortcut I have, the remote file system is mounted and visible as expected. It also works if I do something like

ls -l /home/dean/backup

So a quirk (bug?) of Dolphin that probably should be reported. It would really only be apparent when using the autofs (or systemd automounting) mechanism.

Ok, that looks as expected.