Let’s make the files on your NetBSD machine browseable via Samba!
There’s already a HOWTO article on the NetBSD wiki but it’s super old and the instructions don’t apply anymore. Here’s a more up-to-date tutorial. I just confirmed these instructions work on NetBSD/amd64 9.0 RC 2, which is… pretty dang recent.
First, install Samba. I suppose you could use pkgin
but I built it with pkgsrc instead.
$ cd /usr/pkgsrc/net/samba
$ make && make install clean clean-depends
Now we need to enable a bunch of daemons in /etc/rc.conf
.
smbd=YES
nmbd=YES
winbindd=YES
samba=YES
Now in order to be able to enable those services, we need to add them to /etc/rc.d.
$ sudo ln -sf /usr/pkg/share/examples/rc.d/smbd /etc/rc.d/smbd
$ sudo ln -sf /usr/pkg/share/examples/rc.d/nmbd /etc/rc.d/nmbd
$ sudo ln -sf /usr/pkg/share/examples/rc.d/winbindd /etc/rc.d/winbindd
$ sudo ln -sf /usr/pkg/share/examples/rc.d/samba /etc/rc.d/samba
Before we start the server, let’s very quickly tune the Samba configuration
file, /usr/pkg/etc/samba/smb.conf
. There’s a pre-defined section called
[homes]
which we can edit. I made mine browseable and read-only.
[homes]
comment = Home Directories
browseable = yes
writable = no
There are several daemons involved, but in order to actually get everything running, you only need to start the ‘samba’ service.
$ sudo service samba start
A Samba server can maintain its own set of credentials, which can be different from your ordinary user credentials. If you like, you can even create a dedicated ‘samba’ user and limit Samba access to only that user (look up the ‘valid users’ config option). But at a minimum, let’s set up a username/password.
$ sudo smbpasswd -a -U <username>
The smbpasswd
program will invite you to provide a password for this new
Samba user.
And that’s it! In my experience, you don’t need to restart the samba service in order for the new credentials to be recognized by clients.
I confirmed stuff was set up OK because my MacBook could connect to it! In the
Finder, you can visit “Go > Connect to Server…” (or hit Command-K) and then
type in the address of the NetBSD machine, with the smb://
protocol.
My initial (and very simple) configuration clearly isn’t optimized. Both of these options seem to be the same. I’ll deal with that later.
And there we go! I can browse the files just fine in the Finder. Of course, the real test is seeing if you can access the files from a Windows machine. Let me know if that works out for you!
No comments:
Post a Comment