So, let's start setting up a basic nsmb.conf file. First, we want to
be able to find hosts. For this we need a workgroup and a NetBIOS
name server. I also have the same user name across the entire domain,
so I'm going to put my user name in the [default] section.

[default]
workgroup=EXAMPLE
nbns=192.168.2.80
username=mlucas

With this information, you should be able to perform basic SMB name
queries. smbutil(1) can perform basic NetBIOS name resolution.

I can now do basic file operations, including using emacs and
StarOffice on the documents in this folder. Life just got a little
better. mount_smbfs includes several options to fine-tune the mount
behavior, however. We can customize the nsmb.conf file to use
different user names to access different shares, or to bypass NetBIOS
name resolution for particular hosts. Here's a more complicated
example, with comments.

[default]
workgroup=EXAMPLE
nbns=192.168.2.80
username=mlucas
#I have a share on my desktop with a separate password
[desktop:mlucas]
password=$$1725a5038393e12ee
#development is in a different NT domain, with
#a shared username
[development]
workgroup=EXAMPLE2
username=support

Ownership of files across these systems can be problematic. Your Unix
user names probably don't map to Windows user names, and Unix has a
different permissions scheme. Because you're using a single Windows
user name to access the share, you have whatever access that account
has to the Windows resources. You should assign the proper Unix
permissions for that share, however. By default, mount_smbfs assigns
the new share the same permissions as the mount point used. The
directory /home/mwlucas/smbmount in our example is owned by "mwlucas",
in the group "mwlucas", and has mode 755. I can edit what's in this
directory, but no other users can. You can use mount_smbfs's -f
option to choose a different mode, and the -d option to choose a
different directory mode. For example, to set it so only I could
access the contents of this directory I would use mount_smbfs -d 700.
(This would make the Unix permissions far more stringent than the
Windows ones, but that's not my concern at the moment.) I can even
change the owner with the -u option, and the group with the -g option.

The -I option tells mount_smbfs to skip NetBIOS name resolution, and
instead use the host name or IP address provided on the command line.

-N means that mount_smbfs should read the password from the
configuration file, and not prompt for a password. This means that
you need to have your clear-text password in nsmb.conf.

The -W flag specifies a new workgroup. It overrides any settings in nsmb.conf.

Windows is case-insensitive; Unix is case-sensitive. SMBFS defaults
to leaving the case as it finds it, but this is not necessarily what
you want. The -c flag tells mount_smbfs to change the case. -c l changes everything to lowercase, while -c u changes everything to uppercase.

In working with mount_smbfs, I've found it flexible enough to handle almost any situation on a Windows network. This allows you to use
your FreeBSD system seamlessly with the rest of the office.