Samba mount as user

I’m trying to set up cifs mount to remote samba server following Samba - NixOS Wiki
But it seems something is broken, I get “permission denied” when I try to mount share as user. My config:

  fileSystems."/media/storage" = {
      device = "//server/share";
      fsType = "cifs";
      options = let
        automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";

      in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
  };
  security.wrappers = {
    mount.source = "${pkgs.utillinux}/bin/mount";
    umount.source = "${pkgs.utillinux}/bin/umount";
  };
  security.wrappers."mount.cifs".source = "${pkgs.cifs-utils}/bin/mount.cifs";
  services.gvfs.enable = true;
~ >:/ mount.cifs //server/share /media/storage
mount.cifs: permission denied
~ >:/ ll `which mount.cifs`
-r-s--x--x 1 root root 17688 июн 20 21:19 /run/wrappers/bin/mount.cifs
1 Like

Why are you trying to manually mount it? You have it configured as an auto mount so the folder will mount when you need it and unmount when you don’t.