Networking / Beginners

Server Message Block (SMB) or CIFS

In a heterogeneous network, you may have different operating systems running, such as Microsoft Windows, that do not support NFS file sharing natively.

The SMB protocols or Windows File Sharing protocols are Microsoft's file sharing protocols that are mainly used on Windows operating system.

Your FreeBSD host can act as SMB client and server to make the integration into heterogeneous networks, easier.

This means that you can mount SMB shares using mount_smbfs(8), which is a FreeBSD's built-in utility. Your FreeBSD server can also act as a SMB file and print server using popular open-source SAMBA package.

SMB Client

As mentioned earlier, FreeBSD comes with a built-in utility to mount SMB shares. The mount_smbfs(8) utility can mount SMB shares to local mount points, and can also be used in the /etc/fstab file to mount SMB shares automatically, on system start up.

The typical mount_smbfs command looks like this:

# mount_smbfs -I //admin@babak-winxp/cygwin /mnt/cygwin

This will mount a share called cygwin from a host called babak-winxp with IP address The share is mounted with the permission of user admin and the password is asked for, during the mount process.

Note that the -I parameter takes the actual IP address of the SMB server (in this case You should also specify the name of the SMB server (for example babak-winxp). In case you do not specify the IP address of your server using the -I options, the IP address will be looked up from the host name, using NetBIOS name resolver. However, it would be a good idea to use -I to speed up the mounting process.

Once you enter this command, the password for the specified user, in this case, admin, is asked. If the authentication succeeds, the remote share will be mounted to the node you have specified (/mnt/cygwin in this example).

You can also verify whether the share is mounted as you wanted as shown here:

# mount
    /dev/ad0s1a on / (ufs, local, noatime, soft-updates)
    devfs on /dev (devfs, local)
    procfs on /proc (procfs, local)
    /dev/md0 on /tmp (ufs, local)
    //ADMIN@BABAK-WINXP/CYGWIN on /mnt/cygwin (smbfs)

The last line of the mount(8) output shows that the share has been mounted successfully.

Note that you can also unmount the mounted share like a typical mount point, using the umount(8) utility

# umount /mnt/cygwin
[Previous] [Contents] [Next]