Doing the Samba Dance


Until now, you probably thought of Samba as an intricate Brazilian dance with fun rhythms. But in the Linux world, Samba refers to a file-and printer-sharing program that allows Linux to mimic a Windows file and print server so Windows computers can use shared Linux directories and printers. If you want to use Linux as a file or print server in a Windows network, you have to know how to dance the Samba.

Understanding Samba

Because Linux and Windows have such different file systems, you can't create a Linux file server simply by granting Windows users access to Linux directories. Windows client computers couldn't access files in the Linux directories. There are just too many differences between the file systems-these, for example:

  • Linux filenames are case-sensitive; Windows filenames aren't. For example, in Windows, File1.txt and file1.txt are the same file. In Linux, they're different files.

  • Linux filenames can contain periods. In Windows, only one period is allowed-and it separates the filename from the file extension.

  • Windows has file attributes, such as Read-only and Archive. Linux doesn't have these.

More fundamentally, Windows networking uses a protocol called SMB, which stands for Server Message Block, to manage the exchange of file data between file servers and clients.

Linux doesn't have SMB support built in. That's why Samba is required.

Samba is a program that mimics the behavior of a Windows-based file server by implementing the SMB protocol. When you run Samba on a Linux server, Windows computers on your network see the Linux server as if it were a Windows server.

Like a Windows server, Samba works by creating and designating certain directories as shares. A share is simply a directory that's made available to other users via the network. Each share has the following elements:

  • Share name: The name by which the share is known over the network. Share names should be eight characters whenever possible.

  • Path: The path to the directory on the Linux computer that's being shared, such as \Users\Doug.

  • Description: A one-line description of the share.

  • Access: A list of users or groups that have been granted access to the share.

Tip 

Samba includes a client program that lets a Linux computer access Windows files servers.

TECHNICAL STUFF 

Why did Samba's developers choose to call their program Samba? Simply because the protocol that Windows file and print servers use to communicate with one another is called SMB, which stands for Server Message Block. Add a couple of vowels to SMB and you get Samba.

Installing Samba

If you didn't install Samba when you installed Linux, you have to install it now. The easiest way to do that is to use Fedora's GNOME-based package management tool to install Samba. Just insert the Fedora distribution CD in the CD drive and then click Yes when you're asked whether you want to run the autorun program. Then, when the Package Management window appears, select the Windows File Server group, which installs the Samba packages for you.

Warning 

One sure way to render a Samba installation absolutely useless is to enable the default Linux firewall settings on the computer that runs Samba. The Linux firewall is designed to prevent users from accessing network services, such as Samba. It's designed to be used between the Internet and your local network, not between Samba and your local network. Although it's possible to configure the firewall to allow access to Samba only to your internal network, a much better option is to run the firewall on a separate computer. That way the firewall computer can concentrate on being a firewall, and the file-server computer can concentrate on serving up files.

Starting and stopping Samba

Before you can use Samba, you must start its two daemons, smbd and nmbd. Both can be started at once by starting the smb service. From a command shell, use this command:

 service smb start 

Whenever you make a configuration change, such as adding a new share or a creating a new Samba user, you should stop and restart the service with these commands:

 service smb restart 

If you prefer, you can stop and start the service with separate commands:

 service smb stop service smb start 

If you're not sure that Samba is running, enter this command:

 service smb status 

You'll get a message indicating whether the smbd and nmbd daemons are running.

To configure Samba to start automatically when you start Linux, use this command:

 chkconfig -level 35 smb on 

To make sure the chkconfig command worked right, enter this command:

 chkconfig -list smb 

You should see output similar to the following:

 Smb       0:off  1:off  2:off  3:on   4:off  5:on   6:off 
REMEMBER 

Services can be independently configured to start automatically for each of the six boot levels of Linux. Boot level 3 is normal operation without an X server; level 5 is normal operation with an X server. Thus, setting smb to start for levels 3 and 5 makes smb available whether or not you're using a graphical user interface.

You can also start and stop Samba with the Service Configuration tool, as shown in Figure 24-6. Scroll down the list of services until you find the smb service. You can use the three buttons in the toolbar at the top of the window to start, stop, or restart a service.

Using the Samba Server Configuration tool

Fedora includes a handy GNOME-based configuration tool that simplifies the task of configuring Samba. To start it, choose Main Menu image from book System Settings image from book Server Settings image from book Samba Server. When you do, the Samba Server Configuration window appears, as shown in Figure 24-8. This tool lets you configure basic server settings and manage shares.

image from book
Figure 24-8: Using the Samba Server Configuration tool.

To make your Samba server visible on the network, choose Preferences image from book Server Settings. This brings up a dialog box that lets you set the workgroup name (which must match the workgroup or domain name you want the Samba server to belong to) and a description for the server, as well as some basic security settings that control how users can access the Samba server.

You can set four basic types of security for your Samba server:

  • Domain: Configures the Samba server to use a Windows domain controller to verify the user. If you specify this option, you must

    • Provide the domain controller's name in the Authentication Server field.

    • Set Encrypted Passwords to Yes (if you use Domain mode).

  • Server: Configures Samba to use another Samba server to authenticate users.

    Tip 

    If you have more than one Samba server, this feature lets you set up user accounts on just one of the servers. Then, in the Authentication Server field, specify the name of the Samba server that should perform the authentication.

  • Share: Authorizes users separately for each share they attempt to access.

  • User: Requires that users provide a valid username and password when they first connect to a Samba server. That authentication then grants them access to all shares on the server, subject to the restrictions of the account they're authorized under.

    TECHNICAL STUFF 

    User mode is the default.

For each network user who needs to access the Samba server, you must

  1. Create a Linux user account for each user.

  2. Create a separate Samba user account.

TECHNICAL STUFF 

The Samba user account maps to an existing Linux user account, so you must create the Linux user account first.

To create a Samba user account, choose Preferences image from book Samba Users from the Samba Server Configuration window. This brings up the Samba Users dialog box, as shown in Figure 24-9. You can use this dialog box to add, edit, or delete users.

image from book
Figure 24-9: The Samba Users dialog box lists your Samba users.

To be useful, a file server should offer one or more shares-directories that have been designated as publicly accessible via the network. Again, you use the Samba Server Configuration program to manage your shares. To add a share, click the Add button in the Samba Server Configuration program's toolbar. This brings up the Create Samba Share dialog box, as shown in Figure 24-10. You can then

  • Enter the path for the directory you want to share.

  • Enter a description for the share.

  • Select whether to allow either read-only or read-write access.

  • Click the Access tab if you want to set limits on access (for example, to specific users).

image from book
Figure 24-10: The Create Samba Share dialog box.

Tip 

When you create a new share using the Samba Configuration program, the share should be immediately visible to network users. If not, try restarting the Samba server, as I describe in the section, "Starting and stopping Samba," in this chapter.




Networking For Dummies
Networking For Dummies
ISBN: 0470534052
EAN: 2147483647
Year: 2004
Pages: 254
Authors: Doug Lowe

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net