[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Samba user mounts

From: Mathieu Lirzin
Subject: Re: Samba user mounts
Date: Mon, 15 Jan 2018 20:11:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello Ricardo,

Ricardo Wurmus <address@hidden> writes:

>> I want to connect to my NAS using the Samba protocol.  While I can use ‘gvfs’
>> for that it is not convenient for me to access it from the command line via
>> the “/run/user/1000/gvfs/smb-share:server=nas,share=home/” filename.  On my
>> previous system I was able to add the following line in my “/etc/fstab” file:
>>    //nas/home /mnt/mthl/nas-home          cifs  
>> credentials=/home/mthl/.smbfile,rw,noauto,user 0 0
>> which allowed me to execute the following command as a regular user:
>>    $ mount /mnt/mthl/nas-home
>> Does anybody know how to achieve similar thing on GuixSD?
> I have this in my config:
>     (file-system
>      (device "//my.nas/the-share")
>      (title 'device)
>      (options "uid=1000,gid=1000,credentials=/etc/samba.credentials")
>      (mount-point "/nas")
>      (type "cifs")
>      (mount? #f)
>      (create-mount-point? #t))
> And it does the right thing when I run “mount /nas”.
> Does this help?

Indeed this helps greatly.  The only remaining minor issue is that the
‘mount’ command still needs to be run as root.  I have added the “user”
option and turn ‘mount.cifs’ into a setuid program.

   (device "//")
   (title 'device)
   (options "uid=1000,gid=1000,credentials=/home/mthl/.smbfile,user")
   (mount-point "/mnt/nas-home")
   (type "cifs")
   (mount? #f)
   (create-mount-point? #t))

  (setuid-programs (cons (file-append cifs-utils "/sbin/mount.cifs")

However I am still unable to mount this as a regular user:

--8<---------------cut here---------------start------------->8---
  $ mount /mnt/nas-home
  This program is not installed setuid root -  "user" CIFS mounts not supported.
--8<---------------cut here---------------end--------------->8---

What happens I think is that ‘mount’ calls the ‘mount.cifs’ from the
store and not to the one in the “/run/current-system/setuid-programs”
directory.  I don't know how this could be fixed.

Thank you very much for this very helpful snippet.

Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

reply via email to

[Prev in Thread] Current Thread [Next in Thread]