Samba Server Configuration for file sharing and printer sharing

Simplest way to create a home group network between Windows and Linux OS.

Samba Server Configuration

What is Samba?

Samba is a free software that implements the SMB Networking Protocol.  It was developed by Andrew Trigdell.  It provides the file and printer service for various Microsoft Windows Clients.

It is available on various platforms.  In the following tutorial, we will see how to use the Samba server to make files available across the network from a Linux computer to a windows computer.

Minimum Requirement for learning the Configure Samba Server tutorial:

  • The Linux distro that is used in this tutorial is CentOS.
  • The following tutorial will work with almost all versions of Linux and all version of Samba.
  • The only difference between the versions is that there might be
  • some difference between the file locations.

What can we do with Samba Server Configuration:

We can use Samba for sharing files and printers with Microsoft Windows OS from a Linux OS.  There is a Linux OS that is running Samba with a printer attached to it, we can use Samba Server Configuration for sharing the attached printer with a Windows Computer.

This server is configured for file and printer sharing.  Then there are Windows OS Clients that are running Windows 10/8.1/ 7 and even XP.  It is connecting to the Samba server hosted Linux OS and accessing file sharing in the printer.  It can also be used for authentication for Windows Domain Controller.  But it is not used as much as file sharing.

How to Samba Server Configuration:

When it comes to Samba, we need to consider two files, one which we edit directly and one which we edit indirectly.  We edit the SMB.con file, it is typically the configuration file and it is located in


This is the main configuration file.  The components mentioned in this tutorial are associated with this smb.con file directly or indirectly with the include statements.  There are two parts to it, the global options and shared definitions.  In global option we can set the following:

  • Network options
  • Login options
  • Stand-alone server options
  • Domain Member options
  • Domain Controller options
  • Browser Controller options
  • Name Resolution options
  • Printing options
  • Filesystem options

In Network options, we set the WorkGroup name, Serve name, Interfaces, allowed subnets,

Login options are used to set the log size.

Standalone server is used to for security and what type of authentication we are going to use.

Domain Member options is where the user information is stored.

Domain Controller is where we have the actual backend.

Browser Control option is where we manage the Network browser options.  Please keep in mind that this is different from the Web Browser.

Name Resolution is used to manage the Samba Names

Printing Options lists where the list of printers are loaded and how windows Clients handles drivers.

File System is used if we are working with the FileSystem that supports extended attributes.

Usually, the users are recommended to go with the default settings.  We usually have to work on the network options and the shared definitions.

The following are the contents of the Shared Definitions.  This is at the bottom of the smb.conf.   This is where the default shares are configured.  The Default Shares are the home directory where the users home directory which is used for printers.  Profiles are for specific rowing profiles

The public is for setting up a read-only public directory.

Configuring Samba is very straight forward.

  • We have to edit the etc/samba/smb.conf file.
  • Restart the Samba server and create SMB users.

If we are able to do it correctly, the Windows users will be able to access the shares.

The following tutorial is based on Samba installed in CentOS.  If Samba is not already installed, please use Yum to install Samba.

Login into the CentOS as root and enter the following command.

cd etc/samba

now enter the following command as well.


It is recommended to make a backup of a configuration file before modifying it.

Use the following command to open smb.conf in the VI

vi smb.conf

Navigate to global settings and modify the workgroup name.  You can copy and paste the following for setting the workgroup.

workgroup = TecKangaroo

Now copy and paste the following for the server string.

server string = TecKangaroo

The next options that we see are the interfaces and host allow.  This is where we set the subnet using which we limit the host that is allowed to connect.  When we do not set a specific subnet, we are essentially permitting everyone into the server.

Now lets us go to the bottom of the file.  This is where we go to the shared definitions.  Here we will add the following definition.  Press Ctrl+O to open a new line.  We will add the following line.


comment = Samba Demo Directory

path = /smbdemo

public  = yes

writeable = yes

Now press the escape button

Press : and w and q.

Now let us go ahead and add some Samba Users.  Use the following command to add a password.

smbpasswd -a tk1

New SMB password:  *********

Please make sure that the password synchronizes with the password in the windows computer.

Use the following command to list all the Samba Users

pdbedit -l

the following is the output:

tk1:502:User One

Enter the following command to verify if they are properly configured or not.


Now press enter again.

Enter the following command in the terminal

service smb restart

Now if we go to Windows and see, we can actually connect to the shared drive.

Go to the network browser and enter the IP address in the address bar.

Now the users are able to see the shared folder.  Now, let us add a new file to this path and view it from the Linux node.

In the Linux, node enter the following command.


This will list all the content of the directory.  Here we can see that, file added into the directory is highlighted in a different colour.  The reason for that is, the user does not have the same permission as the for the other files in the directory.

Common Errors in Samba Server:

  • Syntax errors in samba server conf file.
  • The Linux and Windows user names are different.
  • Firewall permissions are not enough for the connection.  The standard ports are 137, 138 and 139.  They are both TCP and UDP.


The above post shows how to configure Samba Serve.  Samba Server Configuration is a very useful topic as it lets many users to Share Linux folders across the network with Windows users.  Learn how to Configure Samba Server here and also let us know if there is something that you would like to know about the Samba Serve Configuration in more detail.

Leave a Reply

Your email address will not be published. Required fields are marked *