In this tutorial, we will show you how to install Samba on Debian 10. For those of you who didn’t know, Samba allows you to share files and printers with other computers remotely, regardless of their operating system. It lets you access your desktop files from a laptop and share files with Windows and macOS users.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Samba on a Debian 10 (Buster).
Prerequisites
- A server running one of the following operating systems: Debian 10.
- It’s recommended that you use a fresh OS install to prevent any potential issues
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Samba on Debian 10 Buster
Step 1. Before running the tutorial below, it’s important to make sure your system is up to date by running the following apt
commands in the terminal:
sudo apt update
Step 2. Installing Samba on Debian 10.
Now we run the following command to install the Samba server:
sudo apt install samba
Verifying Samba installation using the following command below:
sudo systemctl start nmbd sudo systemctl status nmbd
Step 3. Configure Samba.
The samba configuration file smb.conf
is located at the /etc/samba
directory. Before editing the configuration file, make sure to create a backup of this file:
sudo cp /etc/samba/smb.conf ~/Documents smb_backup.conf
Now edit the original configuration using the following commands:
sudo nano /etc/samba/smb.conf
Add the following lines:
[samba-share] comment = Samba on Debian path = /samba read-only = no browsable = yes
Next, set up a user account. The Samba user must have to be the system user and therefore should exist in the /etc/password
file. If a user does not already exist, you will first need to create it:
sudo smbpasswd -a username
Once done, restart the Samba service by running the following command:
sudo systemctl restart smbd.service
Step 4. Connect Samba share from Linux.
Now run the following command in the Terminal to install the Samba client:
sudo apt install smbclient
Once successfully installed, connect to Samba share using the following syntax:
sudo smbclient //[Your-IP-address or Host_name]/share_name –U samba_user
- [Your-IP-address or Host_name] is the IP address or the hostname of the Samba server
- [share_name] is the name of the Samba shared directory
- [samba_user] is the name of the user who has access to the share
Congratulations! You have successfully installed Samba. Thanks for using this tutorial for installing the latest version of Samba on the Debian system. For additional help or useful information, we recommend you check the official Samba website.