NetBSD-Users archive

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

Re: smb/cifs



There is no in-kernel SMB client any more.  mount_smbfs(8) and nsmb(4)
were removed from -current in April 2020, so they are absent from
NetBSD 10 and 11.  They only ever spoke SMB1, which current servers
disable anyway.

What does work is FUSE over NetBSD's native puffs/refuse layer, using
smbnetfs from pkgsrc-wip (wip/fuse-smbnetfs, built against
net/samba4).  I tested it today on NetBSD-current (11.99.9, amd64) with
samba-4.24.7, against an authenticated share on a QNAP NAS (SMB2/3).
Listing, reading, creating and writing files all work.

1. Build and install:

     cd /usr/pkgsrc/wip/fuse-smbnetfs && make install

2. Configure (the package now installs these notes as
   share/doc/smbnetfs-0.6.3/README.pkgsrc):

     mkdir ~/.smb
     cp /usr/pkg/etc/samba/smb.conf ~/.smb/
     cp /usr/pkg/share/examples/smbnetfs/smbnetfs.conf ~/.smb/

   Because SMB1 is off, network browsing finds nothing, so name the
   server explicitly in ~/.smb/smbnetfs.conf:

     host nas.example.org visible=true

   Put the credentials in ~/.smb/smbnetfs.auth, which the example
   smbnetfs.conf already includes.  Use one line per share, or leave
   out "/share" to use the same login for the whole host:

     auth "nas.example.org/share" "user" "password"

   smbnetfs silently ignores host and auth lines unless both files are
   mode 600:

     chmod 600 ~/.smb/smbnetfs.conf ~/.smb/smbnetfs.auth

3. Mount:

     sysctl -w security.models.extensions.usermount=1   # as root, for
non-root mounts
     smbnetfs /mnt/smb
     ls /mnt/smb/nas.example.org/share

   Shares appear as <mountpoint>/<host>/<share>.  For debugging, add
   "-o log_file=/tmp/smbnetfs.log,smbnetfs_debug=2".

Caveats:

- Unmounting: a plain "umount /mnt/smb" hangs, waiting for a reply
  from the daemon.  While it is stuck, any other mount(8) call blocks
  as well.  Kill the daemon first, then unmount:

     pkill -9 -f 'smbnetfs /mnt/smb'; umount /mnt/smb

  I have not yet worked out whether refuse/puffs or smbnetfs is at
  fault.

- df shows the mount as 0 blocks and 100% full; that is cosmetic
  (see -o free_space_size=N).

- On a guest-only share I could read and create files but not write
  data into them.  smbclient(1) was refused in the same way, so that
  was the server's guest permissions, not smbnetfs.

If SSH is available on the server, filesystems/fuse-sshfs is an
alternative, and NFS is of course native.

So on my NetBSD-current host I have atm for the test:

mount | grep puffs
/dev/puffs on /mnt/smb type puffs|refuse:smbnetfs (nodev, nosuid)

in /root/.smb/smbnetfs.conf :

include                 "smbnetfs.auth"
include                 "smbnetfs.host"
host XXXX.YYY.ZZZ visible=true

in /root/.smb.smbnetfs.auth:

auth "XXXX.YYY.ZZZ/share" "user" "password"

and the command to mount it would be

/usr/pkg/bin/smbnetfs /mnt/smb -o log_file=/tmp/smbnetfs.log,smbnetfs_debug=2

then you will be able to see /mnt/smb/XXXX.YYY.ZZZ/share

On Fri, 9 Oct 2026 at 14:27, Andrew Ball <asbatwrk%gmail.com@localhost> wrote:
>
> Hello Jeff,
>
>   J> But, what the heck, I installed it to see if it would provide
>    > mount_smbfs.  It did not.  It does include smbclient, which I
>    > tested successfully.  However, I am not interested in inter-
>    > active, ftp-style interaction with the smb share.  I want to
>    > mount it as if it were a local directory.  When I attempt to
>    > do so I get: mount: exec mount_smbfs for /network_music:
>    > mount_smbfs: No such file or directory
>
>     Another mistake on my part.  I had expected the samba client
> to let you mount an smb share.
>
> -Andy Ball.



-- 
----


Home | Main Index | Thread Index | Old Index