If you install Samba from your Fedora DVD, you can find a large amount of documentation in the directory tree, starting at /usr/share/doc/samba*/doc/ in several formats, including PDF, HTML, and text, among others. Altogether, almost 3MB of documentation is included with the source code.
After Samba is installed, you can either create the file /etc/smb.conf or use the smb.conf file supplied with Samba, which is located by default under the /etc/samba directory with Fedora. Nearly a dozen sample configuration files can be found under the /usr/share/doc/samba*/examples directory.
Depending on your needs, smb.conf can be a simple file of fewer than 20 lines or a huge file spanning many pages of text. If your needs are complex, I suggest picking up a copy of Using Samba, 3rd Edition by Carter, Ts, and Eckstein (O'Reilly, 2007).
Configuring Samba with system-config-samba
Fedora benefits from a slew of utilities that were developed as part of the original Red Hat Linux. Fortunately, work has carried on after Red Hat Linux was discontinued and the Samba configuration tool has lived on. And although it hasn't undergone major enhancements since Fedora Core 1, it is still a very useful tool to have to hand when configuring basic Samba services.
You can access it under System, Administration, Samba, and the opening screen is shown in Figure 19.2.
FIGURE 19.2 system-config-samba, a great way to get up and running quickly with Samba.
To get started, just click the Add Share icon in the toolbar, or select Add Share from the File menu. Either way takes you to the basic settings screen shown in Figure 19.3.
FIGURE 19.3 Click the Browse button to locate the folder you want to share.
In the basic settings, you need to provide the path to the folder that you want to share via Samba. You also need to give it a share name, and an optional description. If you plan on setting up a number of shares, you might want to consider filling out the description to help you distinguish between them all.
Next up you need to select one or both of the check boxes to allow users to view (visible) and or write (writable) to the folder. Subdirectories underneath the specified directory inherit the permissions stated here.
Configuring Samba with SWAT
The Samba team went all out to provide a handy GUI tool to administer almost every aspect of Samba, called SWAT. This section provides a simple example of how to use SWAT to set up SMB access to a user's home directory and how to share a directory.
You need to perform a few steps before you can start using SWAT. First, make sure you have the Samba and the samba-swat RPM packages installed. To then enable SWAT access to your system, edit the /etc/xinetd.d/swat file by changing the following line:
disable = yes
Change the word yes to the word no, like so:
disable = no
Note that you must do this as root, as regular users cannot change this file. Save the file, and then restart the xinetd daemon, using either the system-config-services client or the xinetd shell script under /etc/rc.d/init.d, as follows:
# service xinetd restart
Next, start an X session, launch any web browser, and browse to the http://localhost:901 uniform resource locator (URL). You are presented a login prompt. Enter the root username and password, and then click the OK button. The screen clears, and you see the main SWAT page, as shown in Figure 19.4.
FIGURE 19.4 SWAT can be used to easily configure and administer Samba on your system.
You can also configure Samba with Fedora's system-config-samba client. Launch the client from the command line of an X terminal window or select the System, Administration, Samba menu item (as shown later in Figure 19.10).
First, click the GLOBALS icon in SWAT's main page. You see a page similar to the one shown in Figure 19.5. Many options are in the window, but you can quickly set up access for hosts from your LAN by simply entering one or more IP addresses or a subnet address (such as 192.168.0. — note the trailing period, which allows access for all hosts; in this example, on the 192.168.0 subnet) in the Hosts Allow field under the Security Options section. If you need help on how to format the entry, click the Help link to the left of the field. A new web page appears with the pertinent information.
FIGURE 19.5 Configure Samba to allow access from specific hosts or subnets on your LAN.
When finished, click the Commit Changes button to save the global access settings. The next step is to create a Samba user and set the user's password. Click the PASSWORD icon on the main SWAT page (refer to Figure 19.4). The Server Password Management page opens, as shown in Figure 19.6. Type a new username in the User Name field; then type a password in the New Password and Re-type New Password fields.
FIGURE 19.6 Enter a Samba username and password in the SWAT Password page.
You must supply a username of an existing system user, but the password used for Samba access does not have to match the existing user's password.
When finished, click the Add New User button. SWAT then creates the username and password and displays Added user username (where username is the name you entered). The new Samba user should now be able to gain access to the home directory from any allowed host if the Samba (smb) server is running.
For example, if you have set up Samba on a host named rawhide that has a user named andrew, the user can access the home directory on rawhide from any remote host (if allowed by the GLOBALS settings), perhaps by using the smbclient command like so:
$ smbclient //rawhide/andrew -U andrew
Password:
Domain=[RAWHIDE] OS=[Unix] Server=[Samba 3.0.26a-6.fc8]
smb: \> pwd
Current directory is \\rawhide\andrew\
smb: \> quit
Click the Status icon in the toolbar at the top of the SWAT screen to view Samba's status or to start, stop, or restart the server. You can use various buttons on the resulting web page to control the server and view periodic or continuous status updates.
You can also use SWAT to share a Linux directory. First, click the Shares icon in the toolbar at the top of the main Samba page (refer to Figure 19.4). Type a share name in the Create Shares field, and then click the Create Shares button. The SWAT Shares page displays the detailed configuration information in a dialog box as shown in Figure 19.7, providing access to detailed configuration for the new Samba share.
FIGURE 19.7 Use the SWAT Shares page to set up sharing of a portion of your Linux file system.