Samba is a Unix flavor of the SMB and CIFS protocols.
It is used for sharing Unix files and printers with windows machines.
SMB/CIFS run on the TCP/IP protocol.

Samba shares:

Samba shares show up as shared folders in windows "Network" once we click on the Samba server name that hosts these shares.

Access restrictions based on the username can be applied to these shares.
Unix users can access shares on the Samba client (windows machine).
Samba consists of two processes or daemons smbd and nmbd.
The SMB daemon deals with the file access, sharing and printing.
The NMB daemon manages name resolution of the files.

Installation of the Samba server:

To begin the Samba installation process, we do the following:

Samba configuration file : (smb.conf):

Below the most important and used elements of the smb.conf file:


We can get the name of the workgroup from the windows machines by looking at the system properties in the control panel or by simply using the below command:

The description of  the samba server:

Description displayed to the samba clients.

List of allowed hosts examples:

The allowed host section lists all the clients that are allowed to connect to the Samba server.
By default Samba allows connection from all the clients.
To allow all the addresses from to, we use:

To allow all the hosts with addresses that start with 192, we use:

To allow multiple IP addresses, we use a list of addresses separated by a comma or a tab:

Configuring Shares:

The diagram below explains the process of connecting to a Samba share.

A share allows users to log in and depending on their access rights, they can read, create or modify files on the share.

The security level (user or share) can be defined in smb.conf, for the user security level we use "security=user", it is the default setting that can be listed in the [global] section of smb.conf.

Example of creating shares: 

In smb.conf file:

Example1 :

Example2 : (with the share creation, groups,...)

Because we want only the users (John, Albert) to access this directory, we create a group (Private_Group) and add John and Albert to it:


Linux system permissions take precedence over Samba permissions.

Adding Users ("smbpasswd" and "pbedit" commands) :

To create, delete, activate and deactivate a user account:

These commands add or remove users from the Samba database file (smbpasswd) .

Using pdedit to create a user:

Useful samba commands:

To list the available shares Samba :

To log into a Samba share:

Starting the Samba server boot time:

To start the Samba server at boot time we add the below to the rc.conf file: 

Brando Sabatini and Ikbal C ©. Powered by Blogger.