How to Install Samba on Debian 12: A Step-by-Step Guide

samba is an open-source software suite that allows you to seamlessly share files, folders or other important data between Windows and Unix-based systems (Linux and macOS). It is like a bridge that connects your system to other systems, no matter what operating system you are using. It is one of the secure methods for remote sharing as it supports various authentication methods that helps in secure access to data.

If you are a Debian user and looking for an easy and quick way to share files and folders to other systems, you must choose samba,

In this guide, you will find:

How to Install Samba on Debian 12

samba Available in the default Debian 12 repository and can be installed directly with the required dependencies using appropriate order given below:

sudo apart to install samba samba-common-bin -ya

How to Install Samba on Debian 12

after installing samba On Debian 12, you'll need to take a few extra steps so you can share files or folders from one computer to another. installation steps samba Below on Debian 12:

Step 1: Create Samba Directory

For better organization of your files, directories, and to protect the privacy of your system, it is recommended to create a new directory. You can use this directory as samba Shared Directory.

Here, I have created a directory with the name samba_dir_debian Using on Debian 12 mkdir Permission:

Step 2: Configure Samba on Debian 12

you will need to configure samba On Debian to allow sharing of files between server and client. You can open the configuration file of samba On using Debian nano editor By the following order:

sudo nano ,etc,samba,smb.conf

After opening the file, add the following lines by replacing the path with the location of the directory you want to share:


path= ,Home,linux,samba_dir_debian


create mask=0777

directory mask=0777


Comment: [linuxhintsamba] There is a dot that you will use later when accessing the directory, this is actually the name of the shared folder so you can write any name you want. Once done, save samba using configuration file CTRL+XAdd Y and press enter,

Step 3: Set a Password for Samba on Debian 12

You must set a strong password for this samba Server As an additional security measure, this password will be used when you connect to the server from another computer. To set password for samba On Debian 12, use the following command:

sudo smbpasswd -A User name

Comment: You will need to add your Debian system's username instead User name Keyword in above command.

Step 4: Restart Samba on Debian 12

after configuring samba And after setting the password, you should now restart samba service on your Debian system via the following command:

sudo systemctl restart smbd

Step 5: Check Samba Status on Debian 12

to ensure samba On Debian the server has active status, this can be done with the following command:

sudo systemctl status smbd

How to connect Debian 12 to Wi-Fi on VirtualBox

If you are using a Debian system on VirtualBox, it is recommended to connect your system to a Wi-Fi network. This will allow you to use the IP address of the system and connect to it quickly through samba,

To connect Debian to Wi-Fi on VirtualBox, use the following steps:

Step 1: Open VM Settings

First, right-click on the virtual machine where you have setup sambathen click on Adjustment Option:

Step 2: Change Adapter Attachment

Now, move towards network section and change net with bridged adapter By selecting it from the list:

Step 3: Select the adapter name

choose adapter name from the list, which is Broadcom 802.11n Network Adapter In my case, then choose Ok button:

This will connect your system to Wi-Fi, you can verify this by running the following host name Permission:

Comment: You can skip this method if you have Debian installed on your own system rather than on VirtualBox.

How to use Samba to share files with Debian 12 and Windows

If you are using Windows system, you can use samba Share files with Debian and Windows using the following steps:

step 1: Open Windows Explorer and click on Computer Options at top:

step 2: then choose map network Drive Option:

step 3: But map network Drive Windows, enter the address as follows:


here, instead of ip addressUse your Debian system's IP address when replacing shared_folder_point The name you set it to step 2 Setup method. After adding the desired address, click on finish Button to start connecting to the server:

step 4: Enter the username and password you set for samba Server:

Once you provide the accurate information, you will be able to view your shared folder on your Windows system. This shared folder is directly linked to the directory you created on Debian 12:

You can confirm this by copying any file from your Windows system and pasting it into the network directory on Windows.

Once done, you will see that the file has been successfully shared with Debian, confirm this by using Ras Orders within the directory:

How to use Samba to share files with Debian 12 and macOS

On macOS, you can share files with Debian 12 using the steps below:

step 1: go to connect to server option from Go Menu on macOS:

step 2: Enter the address as follows, then click Add button:

SMB:,ip address,shared_folder_point

Comment: If you are unable to access the folder, you will need to allow file sharing on Mac sharing Option.

step 3: Username and enter samba Password, then click Add button:

step 4: Again, click on Add Press the button for the last time:

This will connect you to samba server On Debian 12:

How to Use Samba to Share Files with Debian 12 and Linux

If you are using other Linux system with Debian 12, you can use the following steps to access samba To share files with Debian and Linux:

step 1: First, install samba client On your other Linux distros using appropriate installation The order is given below:

sudo apart to install cif-utils samba-client -ya

step 2: Then open Linux Explorer and navigate to other location,

step 3: Enter your server address in connect to server Click on the column and then click on Add button:

SMB:,ip address,shared_folder_point

step 4: Then, use Registered User option, enter of samba server username and password (samba password), You can choose any option from the Password section and once done, click on Add button:

this will open samba Shared folders on your Linux system:


samba Is a useful program that allows sharing files and folders on another system. you can install samba On Debian 12 with its essential packages directly from the appropriate repository. However, you have to setup samba From the configuration file, add a password and select the system where you want to access the shared folder. reaching up to samba The shared directory is different on Windows, macOS or Linux systems and can be followed from the above sections of this guide. After accessing the shared directory, you can transfer files from one system to another by using the shared directory as a communication bridge.

Add comment

By Ranjan