#### SAMBA in NETBSD #### This is a tutorial about how I setup SAMBA in NetBSD. My intention with this tutorial is to teach you how to setup the rc.d scripts, setup a simple smb.conf, and get SAMBA running with minimal fuss. If you just want to mount a shared filesystem you don't need to install anything from pkgsrc. You can use mount_smbfs that comes by default with NetBSD. I first tested this by mounting a "shared" directory on an XP system from a NetBSD 2.0 system. I found that I had to press 2 times when prompted for a password, and then the mount was working at the point I selected to mount the file system. This was interesting, but what I really wanted to do was serve SMB to Windows clients, and for that I needed SAMBA. I wanted to export my ~/media tree, so that Windows XP clients can access the files. This is what I did: # cd /usr/pkgsrc/net/samba # make package That installed the package, and created /usr/pkgsrc/packages/net/samba-3.0.10nb2.tgz I prefer the `make package` command, because I share binary packages with another NetBSD 2.0 system over NFS. My next step was to follow the directions that were printed to the xterm when samba was installed. First I copied these files to /etc/rc.d /usr/pkg/share/examples/rc.d/samba /usr/pkg/share/examples/rc.d/nmbd /usr/pkg/share/examples/rc.d/smbd /usr/pkg/share/examples/rc.d/winbindd Next I edited /etc/rc.conf and added samba=YES smbd=YES nmbd=YES winbindd=YES The next step is to setup the configuration for SAMBA, so that it knows which filesystems to export, the permissions, and so on. I ran the following: cp /usr/pkg/share/examples/samba/adduser.sh /usr/pkg/etc/samba/adduser cp /usr/pkg/share/examples/samba/deluser.sh /usr/pkg/etc/samba/deluser cp /usr/pkg/share/examples/samba/smb.conf.default /usr/pkg/etc/samba/smb.conf Now I edited smb.conf. I didn't want to share any printers, so I commented out the printer section. My major new addition to smb.conf (based on examples and the smb.conf man page) was: [media] comment = George's Media path = /home/gps/media public = yes writable = no The top of the smb.conf file suggests running testparm to verify that the configuration is valid. So, by running testparm smb.conf I get the following result: Load smb config files from smb.conf Processing section "[media]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions # Global parameters [global] workgroup = MAGICHIMO server string = Samba %v (%h) security = SHARE [media] comment = George's Media path = /home/gps/media guest ok = Yes Now that it's all configured, and passes testparm's checks, I started samba. As root I ran: # /etc/rc.d/samba start Next I verified the status by running: # /etc/rc.d/samba status nmbd is running as pid 699. smbd is running as pid 658 880. winbindd is running as pid 687 1009. On the Windows XP client I went into "My Network Places" in the Explorer file manager. I then added \\192.168.0.2\media and the file system was readable from the XP client. For more advanced usage you can follow the directions on the SAMBA site. For example, you may want to only allow certain IP addresses (for security), or password protect your shares. I am behind a firewall, and the ports that SAMBA uses are not forwarded, so the SAMBA shares are only accessible from my LAN. May your bits toggle, George