Configuring Samba in Debian 10

Samba allows you to access the files via local network from computers running any operating system. Samba also provides access control to these resources using just one configuration file. In Debian, much of the configuration is generated automatically, which significantly simplifies the configuration of the Samba server.

When you read this manual, you will know how to install Samba server how to configure the global settings of the Samba server, how to configure a new shared resource, how to set a Samba user and how to connect to a shared folder on the other machine.

We will install Samba Debian Buster 10. For installation we will need access to the system with root privileges. Commands starting with # must be run as root user or using sudo the user. Commands starting with $ can be executed as normal non-privileged user.

Installing Samba in Debian 10

In Debian you can install Samba server directly from the repositories. The installation is performed with a single package, you will need to perform only one command:

sudo apt install samba

Samba configuration in Debian

Samba configuration found in the file /etc/samba/smb.conf. This file contains General settings for Samba and the shared resource information. Usually in Debian are good default settings that allow you to start working immediately, which in General does not stop to look at them and make changes where necessary.

1. Basic settings

The first thing you will meet in the top group of global settings workgroup. This option specifies the name of the workgroup, part of which will be your server. The default is WORKGROUPas the same value by default, set in Windows. If you have modified the settings of workgroup in Windows, change them here as well.

workgroup = WORKGROUP

The next option allows you to restrict access to your server. If you want to restrict the share access by ip address or the netmask, remove the comment symbol in the line where the parameter interfaces, and specify the ip address or range of IP addresses, and interface to which they can connect.

interfaces = eth0

If this method you don’t like, you can add a parameter hosts allow to determine the clients that can connect to a shared resource. Specify the IP address or ranges of addresses.

hosts allow =

The remaining parameters in the global settings have quite reasonable defaults. You do not need to change them to run their shared resources. But should not be limited only considered the options, you can explore other settings and adjust them at their discretion. Configuring Samba Debian 10 almost completed, it remains to create a shared folder and the user.

2. Create share

In the configuration file, by default there are several settings to shared resources. They give you the opportunity to share home folders of users and printers. And access to catalog printing is already open. Change the value of the parameter browseable to no.

Now try to create your own shared resource. There are many options that you can use for your Samba share, but in this guide we shall examine only the most used ones.

First, name your share, and put that name in parentheses.

[New Share]

The next line indent is four spaces and write a short comment describing the share.

comment = My new share

Then set the path equivalent to an absolute path to the shared folder.

path = /home/newuser/share

Select whether the folder displayed in the file Manager or it will need to connect manually.

browseable = yes

If you want users to have write access to the shared resource, or could mount it read-only?

read only = no

Guests will be able to access the shared resource? In terms of Samba guests are anonymous users, for which there is no entry in the access permissions for that shared resource. To put it in short, if you want to protect a shared resource with a password, or limit access to the resource only for specific users?

guest ok = no

If guests will not have access to the shared folder, who would it be?

valid users = username

Well, that’s all. There are other options and other ways to perform these basic steps, but they will give you in the end approximately the same result. If you know you need these options you will need. If we combine all what we wrote above – we will get something like this:

[New Share]
comment = A new share
path = /home/newuser/share
browseable = yes
read only = no
guest ok = no
valid users = newuser

Save and close the file. Then restart Samba.

systemctl restart smbd

3. Create user

To connect to a shared folder unless you are using guest access, you need to configure user accounts for Samba. It is very fast and requires just a single command.

smbpasswd-a username

You will then be prompted to enter the password for this user. This is the password which will be protected by the available shared resources.

How to connect to Samba

There are a few packages that you will need to connect to a shared Samba resource. Install them using the following commands.

sudo apt install samba-client cifs-utils

You can now open file Manager and go to Network. There you will see your server and shared the resource you just configured.


Now you know how to install Samba Debian 10 and are ready to begin creating your own shared folder, and configure access to it from other computers Linux. Nothing else to be done, and Samba will start automatically when you boot Debian.


(Visited 3 times, 1 visits today)