4.4. Basic Server Configuration
We now start from scratch and build a configuration file for a new Samba server. Our goal is to create a working server and to examine the options that are important for basic functionality. The server will export a single share named [data].
First, we'll introduce three configuration options that should appear in the [global] section of our smb.conf file:
[global] # Server configuration parameters netbios name = PIGEON workgroup = GARDEN server string = Engr Dept Server (Samba %v) encrypt passwords = yes security = user
This configuration file is pretty simple; it advertises the Samba server under the NetBIOS name PIGEON. In addition, it places the system in the GARDEN workgroup and displays a description to clients that includes the Samba version number. The last two parameters explicitly relate to how Samba is to validate user credentials in connect requests. You've already been briefly introduced to encrypted password support in Chapter 2. The security parameter value of user was not been explicitly mentioned. However, we relied upon it as Samba's default authentication model in Chapter 2 when creating user accounts with smbpasswd and connecting to the server using smbclient. Both parameters are covered in depth in Chapter 5 in the context of users and groups. Until then, the information you previously learned is sufficient for your current needs.
Because this is a perfectly valid configuration file, it is possible to test it out. Create a file named smb.conf under the /usr/local/samba/lib directory and enter the displayed parameters and values. It might also be a good idea to test the new configuration using the same steps that you followed in Chapter 2. Be sure that your Windows clients are in the GARDEN workgroup as well. After double-clicking the My Network Places icon on a Windows client, you should see a window similar to that in Figure 4-2.
Figure 4-2. Browsing the GARDEN workgroup and viewing the Samba server PIGEON
You can verify the server string by either viewing the properties of the Samba host (right-clicking the server icon to launch the context menu and selecting the Properties option), or enabling the details listing of hosts in the workgroup from the View menu. PIGEON's properties are displayed in Figure 4-3.
Figure 4-3. Viewing the properties of a CIFS server
If you were to click the PIGEON icon, a window would appear that shows the services that it provides. In this case, with the exception of the built-in Printers and Faxes icon, the window would be completely empty, because there are no shares defined on the server yet.
4.4.1. Server Configuration Options
Table 4-4 summarizes the server configuration options previously used. All three of these options are global in scope, so they must appear in the [global] section of the configuration file.
188.8.131.52. netbios name
The netbios name option allows you to set the NetBIOS name of the server. For example:
netbios name = YORKVM1
The default value for this configuration option is the server's hostnamethat is, the first part of its fully qualified domain name. For example, a system with the DNS name public.example.com would be given the NetBIOS name PUBLIC by default. Although you can use this option to restate the system's NetBIOS name in the configuration file (as we did previously), it is more commonly used to assign the Samba server a NetBIOS name other than its current DNS name. Remember that the name given must follow the rules for valid NetBIOS machine names as outlined in Chapter 1.
Changing the NetBIOS name of the server is not recommended without a good reason. One such reason might be if the hostname of the system is not unique because the LAN is divided over two or more DNS domains. For example, YORKVM1 is a good NetBIOS candidate for vm1.york.example.com to differentiate it from vm1.falkirk.example.com, which has the same hostname but resides in a different DNS domain.
Another use of this option is to relocate SMB services from a dead or retired system. For example, if SALES is the SMB server for the department and it suddenly dies, you could immediately reset netbios name = SALES on a backup Samba server that's taking over for it. Users won't have to change their drive mappings to a different server; new connections to SALES will simply go to the new server.
The workgroup parameter sets the current workgroup (or domain, as you will see in Chapter 9 and Chapter 10) in which the Samba server will advertise itself. Clients that wish to access shares on the Samba server should be in the same NetBIOS group. Remember that workgroups are really just NetBIOS group names and must follow the standard NetBIOS naming conventions outlined in Chapter 1.
The default option for this parameter is set at compile time to WORKGROUP. Because this is the default workgroup name of every unconfigured Samba system, we recommend that you always set your workgroup name in the smb.conf file. When choosing your workgroup name, make sure to avoid duplicating a name of an existing server or user.[*]
184.108.40.206. server string
The server string parameter defines a descriptive comment string that will be associated with the server. You can use variables to provide information in the description. For example, our previous example entry was:
[global] server string = Engr Dept Server (Samba %v)
The default for this option simply presents the current version of Samba and is equivalent to:
server string = Samba %v