How to build Samba Server on Debian 9

Debian Tutorial – Hello everyone today we will learn how to build Samba Server on Debian 9 Stretch. Debian is great OS for Server and Samba is special application suite that provides file and print services to Windows client. When we have Samba server enabled on a network, we can easily copy, edit and store files to the server from Windows machine. More information about Samba can be read from this link.


This tutorial will guide you to install and configure Samba server on Debian 9 Stretch. With this guide you will be able to install, configure Samba file server on your Debian 9 Server. I try to make it as simple as possible so anyone can follow my tutorial.


The settings on the network could be different but the following tutorial can be used on most cases. Here are my scenario:

  • Debian 9 is installed on a network with IP address
  • The workgroup is “WORKGROUP”
  • We will configure the secure samba server which only Samba users can access the resource

Steps to build Samba Server on Debian 9

Step 1. Install Samba and dependency files

Output example:

Step 2. Create a new shared folder

After install, we need to modify some settings. The Samba server configuration file is located in /etc/samba/smb.conf. You can edit the file using nano or other text editor as you like.

Create a new share

Add the following lines to the bottom of the file /etc/samba/smb.conf. Please note that I leave all the settings inside smb.conf as is. You may tweak it to meet your needs. The default value already gives a good security but it still can be improved.

Close and save the file. Now we need to create the actual directory to share.

Now restart Samba

Add new Samba user

For example, I want to give access to user dhani to use the Samba resource

Now enter the new password for the user to access samba.

Step 3. Mount Samba shared folder from other computer

At this point, our Samba server is up and running. We can try to connect to the shared folder from other computer. For example, I connect to the Debian Samba Server from Ubuntu desktop.

Now we can see the shared folder list on the Debian Samba Server

build samba server on debian 9

In order to connect to the Shared folder, it will ask for user and password. Enter the samba user and password we created earlier.

Be the first to comment

Leave a Reply

Your email address will not be published.