The Structure and Elements of the Samba Configuration File

The Samba services are configured in the file /etc/samba/smb.conf.

The options in the this file are grouped into different sections. Each section starts with a keyword in square brackets.

To set up a simple file server with Samba, do the following:

■ Create a Section for the General Server Configuration

■ Create a Section for the Files to be Shared

Create a Section for the General Server Configuration

The section for the general server configuration starts with the keyword [global]. The following is an example of a basic global section.:

[global]

workgroup = digitalairlines netbios name = fileserver security = share

The entries of the global section in this example are described below:

■ workgroup = digitalairlines

This line sets the Windows workgroup of the Samba server (in this case, DigitalAirlines).

■ netbios name = fileserver

This line sets the name of the system in the NetBIOS name space (in this case, Fileserver).

This line determines how a client has to authenticate itself when accessing a share. This option can have the following values:

□ share. The client does not need to provide a password when initially connecting to the server. However, a password might be necessary when the client tries to access a share.

□ user. The client needs to provide a user name and password when connecting to the server. Samba validates the password against the users available on the Linux system and its own password file.

□ server. The client needs to provide a user name and password when it connects to the server. Samba contacts another SMB server in the network to validate the password.

□ domain. The client needs to provided a user name and password when connecting to the server. Samba connects to the domain controller and validates the password. This works only if Samba joins a Windows domain.

□ ads. Samba acts as domain member of an ADS realm to validate the user name and password.

You might need to configure additional settings for these options to work correctly. For more information, see the man page of smb.conf.

Create a Section for the Files to be Shared

After the global section, you need to add a section for the share of your file server. The following example is the simplest way to set up for a share:

comment = Data path = /srv/data read only = yes guest ok = yes

The entries of the section in this example are described below:

This is the identifier for the share. The share can later be accessed with the address \\Fileserver\data.

This option is a comment with additional information about the share. The comment is displayed when you browse the network with Windows Explorer.

This option sets the path to the exported data on the local file system. You have to make sure that the local user who needs to access the files of this share has sufficient file system rights.

If this option is set to yes, the client accessing the share is not allowed to modify, delete or create any files.

If this option is set to Yes, a password is not required to access the share.

There many more configuration options available than those discussed in this section. For an overview of all options, see the man page of smb.conf.

After you have created a smb.conf file, you should restart the two Samba server daemons:

■ nmbd. This daemon handles all NetBIOS-related tasks.

■ smbd. This daemon provides file and print services for clients in the network.

Continue reading here: How to Use the Samba Tools to Access SMB Shares from a Linux Computer

Was this article helpful?

+1 0