Mounting Samba Shares from FreeBSD

If you took the time to setup Samba it is possible you will want to be able to access those shares from FreeBSD. This quick section explains exactly how to do so using examples from setting up Samba.

mount_smbfs //xaenn@bsd/share /mnt

In this case xaenn is the username, bsd is the first part of your hostname, share is what you defined in smb.conf, and /mnt is the mountpoint. Enter your password when prompted. Alternatively, for the anonymous configuration:

mount_smbfs //guest@bsd/share /mnt

Simply hit 'Enter' when prompted for a password. It is also possible to mount a Shared Folder on a Windows computer using mount_smbfs. To do so, you would use the same command as we used to mount a Samba-shared directory on another *nix machine:

mount_smbfs //mark@brian/conquest /mnt

"Mark" is our username registered on the Windows computer we want to connect to. (If the target Windows computer has the Guest account enabled (it shouldn't if the Windows-user is smart, but then if s/he were even smarter s/he'd be using FreeBSD instead of Windows in the first place), you could replace mark with guest for anonymous access. If you specified a username, you will be challenged for a password once you enter the above command. brian is the Computer Name set by the Windows user. This information can be found in the Windows Control Panel, System, Network Identification, Properties if you're using Windows 2000, and probably on other versions as well. You'll find the computer name listed, not surprisingly, under the label Computer name:. (Don't use the Full computer name also provided; you just want the short one).

Finally, conquest is the name of the shared folder on the Windows computer. To look this up on the Windows computer, right-click the shared folder and look at Properties. Under the Sharing tab you should see the Share name:, which in our example was Conquest. Note that when we issued the mount_smbfs command in FreeBSD we did not capitalize the C in Conquest. That is because Windows is case-insensitive. (Capitalizations in Windows don't mean anything). At any rate, once the Shared Folder is mounted in FreeBSD, you can cd to it and copy files/folders from it just like you would any mounted directory in FreeBSD. Make sure you umount /mnt when you're finished using the Shared Folder.