Share files between Windows and FreeBSD with a minimum of fuss.
You've probably heard of some of the Unix utilities available for accessing files residing on Microsoft systems. For example, FreeBSD provides the mount_smbfs and smbutil utilities to mount Windows shares and view or access resources on a Microsoft network. However, both of those utilities have a caveat: they require an SMB server. The assumption is that somewhere in your network there is at least one NT or 2000 Server.
Not all networks have the budget or the administrative expertise to allow for commercial server operating systems. Sure, you can install and configure Samba, but isn't that overkill for, say, a home or very small office network? Sometimes you just want to share some files between a Windows 9x system and a Unix system. It's a matter of using the right-sized tool for the job. You don't bring in a backhoe to plant flowers in a window box.
2.8.1 Installing and Configuring Sharity-Light
If your small network contains a mix of Microsoft and Unix clients, consider installing Sharity-Light on the Unix systems. This application allows you to mount a Windows share from a Unix system. FreeBSD provides a port for this purpose (see the Sharity-Light web site for other supported platforms):
# cd /usr/ports/net/sharity-light # make install clean
Since Sharity-Light is a command-line utility, you should be familiar with UNC or the Universal Naming Convention. UNC is how you refer to Microsoft shared resources from the command line. A UNC looks like \\NetBIOSname\sharename. It starts with double backslashes, then contains the NetBIOS name of the computer to access and the name of the share on that computer.
Before using Sharity-Light, you need to know the NetBIOS names of the computers you wish to access. If you have multiple machines running Microsoft operating systems, the quickest way to view each system's name is with nbtstat. From one of the Windows systems, open a command prompt and type:
C:> nbtstat -A 192.168.2.10 NETBIOS Remote Machine Name Table Name Type Status ----------------------------------------- LITTLE_WOLF <00> UNIQUE Registered <snip>
Repeat for each IP address in your network. Your output will be several lines long, but the entry (usually the first) containing <00> is the one with the name you're interested in. In this example, LITTLE_WOLF is the NetBIOS name associated with 192.168.2.10.
Once you know which IP addresses are associated with which NetBIOS names, you'll need to add that information to /etc/hosts on your Unix systems:
# more /etc/hosts 127.0.0.1 localhost 192.168.2.95 genisis #this system 192.168.2.10 little_wolf #98 system sharing cygwin2
You'll also need to know the names of the shares you wish to access. Again, from a Microsoft command prompt, repeat this command for each NetBIOS name and make note of your results:
C:> net view \\little_wolf Shared resources at \\LITTLE_WOLF Sharename Type Comment --------------------------------------- CYGWIN2 Disk The command was completed successfully.
Here the computer known as LITTLE_WOLF has only one share, the CYGWIN2 directory.
Finally, you'll need a mount point on your Unix system, so you might as well give it a useful name. Since the typical floppy mount point is /floppy and the typical CD mount point is /cdrom, let's use /windows:
# mkdir /windows
2.8.2 Accessing Microsoft Shares
Once you know the names of your computers and shares, using Sharity-Light is very easy. As the superuser, mount the desired share:
# shlight //little_wolf/cygwin2 /windows Password: Using port 49923 for NFS.
Note that I was prompted for a password because Windows 9x and ME users have the option of password protecting their shares. This particular share did not have a password, so I simply pressed Enter.
However, if the share is on a Windows NT Workstation, 2000 Pro, or XP system, you must provide a username and password valid on that system. The syntax is:
# shlight //2000pro/cdrom /windows -U username -P password
Once the share is mounted, it works like any other mount point. Depending on the permissions set on the share, you should be able to browse that shared directory, copy over or add files, and modify files. When you're finished using the share, unmount it:
$ unshlight /windows
2.8.3 See Also