Accessing Shared Files on a Windows System (the smbfs Filesystem)SMB file sharing can work both ways. Samba allows you to set up your FreeBSD machine as an SMB server only, but there is a way to set it up as a client and mount a remote SMB share like any other volume FreeBSD can read. This involves the use of the SMBFS filesystem, which is not built into the kernel by default, but can be added through a kernel module or compiled into a custom kernel. The SMBFS implementation in FreeBSD includes an smbfs.ko kernel module in /modules and a mount_smbfs tool in /sbin that works like all the other mount_* tools you saw in Chapter 12, "The FreeBSD Filesystem." The best documentation for SMBFS is found in the man mount_smbfs page. To mount an SMB filesystem using smbfs, use mount_smbfs with a few basic options. The -I flag specifies the hostname or IP address of the server, and the two remaining arguments are the remote share name (of the form //user@NetBIOS-hostname/share-name) and the local mount point. To mount the share called public from a Windows machine called gaming-pc onto the local /smb/public directory, use the following syntax: # mount_smbfs -I 64.41.131.139 //guest@gaming-pc/public /smb/public You will be prompted for a password. Use a blank password if the share is set to allow full access; use the appropriate password if the share is set to read-only or password-protected mode. Note The smbfs.ko kernel module is loaded automatically when needed by mount_smbfs. If you want to, you can load it at boot time by adding the following line to /boot/loader.conf: smbfs_load="YES" However, this is probably not necessary unless you regularly mount SMB shares. If you do use SMB shares a lot, you might consider simply building SMBFS support into the kernel, with the following option: options SMBFS To add an SMB share to /etc/fstab, use the following syntax: //guest@gaming-pc/public /smb/public smbfs rw,noauto 0 0 |