Because peer-to-peer networks provide a way to connect a few computers together on "the cheap," we should also take a look at how Linux can fit into a Windows peer network. Linux is becoming an inexpensive alternative to other desktop operating systems (and also in the network operating system arena). This is particularly due to the fact that a number of Linux distributions can actually be downloaded from the Internet for free.
Linux-based computers can be made a part of a Windows workgroup by configuring an add-on program on the Linux computers called Samba . Samba derives its name from SMB or Server Message Block. SMB is an important part of the NetBIOS protocol and supplies the data blocks that make requests between client and server or between peers on a Microsoft network.
Samba is able to simulate the operation of SMB and also provide NetBIOS over IP (TCP/IP being the protocol stack for Linux), which means that a Linux computer can actually pretend to be a Windows client. This means the Linux machine can share folders and printers or access folders and printers in the workgroup.
Many distributions of Linux provide Samba on the installation CDs. In some cases you will have to make sure that Samba is installed as an option when you install the Linux OS. As already mentioned, Samba is installed by default and will actually be up and running on a computer using Lycoris Desktop. Samba can be further configured using a Samba client utility. Other Samba settings can be configured by editing Samba configuration text files. While the prospect of editing configuration files might be a little scary, there are other options for configuring Samba. For example, there is a tool called SWAT (Samba Web Administration Tool) , which allows you to configure Samba from any Web browser. Let's take a quick look at how Samba is configured on a Linux computer, with the understanding that this is certainly not an exhaustive treatise on Linux or Samba.
Configuring and Using Samba
Samba actually consists of two parts: a client and a server. Both of these parts must be configured so that the computer running Linux can both access and serve up shared resources in the Windows workgroup. Configuring the Samba client is very straightforward in most Linux distributions. Lycoris Desktop actually provides a very straightforward way of accessing the Samba client settings. Right-click on the Network Browser icon on the Lycoris desktop and select Configure Network Settings. The Windows Shares dialog box opens as shown in Figure 6.12.
Figure 6.12. The Samba client is most often configured using a desktop utility such as the Lycoris Windows Shares dialog box.
The server side of Samba must also be configured so that you can provide shared resources to other computers in the workgroup. The main Samba configuration file is named smb.conf. This file can be accessed using any file access or search tool provided by your Linux distribution. This file can also be located using the command line if you are familiar with the various commands required to operate at the Linux command line. Figure 6.13 shows the Konqueror window on the Lycoris desktop. It provides a search tool that was used to locate the smb.conf file.
Figure 6.13. You must locate and configure the smb.conf file.
The smb.conf file can be opened in a text editor. There are several sections to the smb.conf file, as shown in Figure 6.14. Most of the settings are straightforward and can be edited intuitively. You must provide a Workgroup name and the name of the server in the Global settings area of the smb.conf file. Other areas of the configuration include the homes area, where you set the home directory for users; the netlogon area of the configuration file, which determines whether or not you will allow guest logons ; and a printers section where you specify print parameters related to shared printers.
Figure 6.14. The smb.conf file can be configured in a text editor.
Manually configuring the smb.conf file can be tricky, so if you are new to Linux, you will probably want to use a Samba configuration tool that makes the entire process a little more intuitive. We discuss SWAT in the next section.
An alternative to manually configuring the Samba configuration file is to use an add-on program to configure Samba. One of the easiest to use Samba configuration tools is SWAT. SWAT is included with some Linux distributions, or you can download it from one of the Linux software repositories on the Web (if you use Lycoris or Red Hat, the distributions have their own Web sites, lycoris.com and redhat.com respectively, that provide you with the ability to easily add software components to your Linux operating system. These services are typically reserved for those who have purchased a copy of the OS, however).
SWAT is also available from a number of Linux software repositories. Checkout www.linux.org and www.linux.com as starting places to locate LINUX add-on software such as SWAT.
Once SWAT is installed on the Linux computer (in some cases some configuration files on the Linux box may have to be customized for SWAT to work; again consult Web resources related to SWAT or consult Sams Teach Yourself Samba in 24 Hours ), you can access the Samba configuration file by invoking SWAT in any Web browser.
In the Web browser address window type http://localhost:901/ and press Enter. The number 901 is actually a port number that allows a TCP connection between SWAT and your Web browser (the port number and the IP address provide the socket used as the communication avenue between TCP and HTTP on the Web browser). Figure 6.15 shows the Samba SWAT program running in the Mozilla Web browser.
Figure 6.15. The SWAT program allows you to configure Samba from a Web browser.
Once SWAT is up and running, you need to configure Samba so that it allows the Linux computer to communicate in the Windows workgroup. This is accomplished using the Samba Globals settings, which is reached by clicking Globals in the browser window.
The two most important settings in the Globals configuration are the name of the workgroup that the computer will belong to and how Windows peers trying to access shares on the Linux box will be validated . Figure 6.16 shows the Globals configuration settings that need to be addressed, such as the workgroup name and the NetBIOS name for the Linux computer.
Figure 6.16. Samba must be configured with the Windows workgroup name.
Linux actually has a lot more robust security than most of the flavors of Windows (except for perhaps Windows 2000 and Windows XP). This means that you need some sort of mechanism that will dilute the security so that Windows clients in the workgroup can easily access shares on the Linux computer without having to provide a username and a password each time they try to connect (the whole point of peer-to-peer networking is to try to keep things as simple as possible).
Samba weakens the Linux security by allowing you to set up a guest account. The guest account is automatically mapped to when one of the Windows peers in the workgroup attempts to access a shared folder on the Linux computer but doesn't provide an appropriate password (because there hasn't been a user account established for the Windows user on the Linux machine). Figure 6.17 shows the Samba screen where the security settings for connections and the guest account is specified (in this case nobody, meaning anyone trying to connect will be considered a guest).
Figure 6.17. Windows users accessing resources on the Linux box are automatically mapped to a guest account.
Shares are also created using SWAT. Directories on the Linux computer are mapped to a share name. This is done using the Shares screen (accessed by clicking Shares in the Web browser window). The Shares screen also allows you to set security options related to a particular share by specifying that the share is read or write. Access to specific hosts in the workgroup can also be allowed or denied using this screen.
Once Samba is completely configured using the SWAT interface (SWAT provides easy access to help files for configuring SAMBA) and the smbd and nmbd services are started using the Status screen of the SWAT utility, the Linux computer is ready to participate in the Windows workgroup. In the next section we look at accessing workgroup resources from Windows and Linux computers.