How to Install and Configure Samba on Linux Mint 21.2


Samba is a sharing software that can operate on different operating systems. It is equipped with built-in security tools that are used to secure your data while sharing across the networks. One of its key advantages is that the Samba server is freely available to everyone. Through this platform, you can effortlessly share files, printers, and other data over a network.

In this article, you will gain the skills to install and configure Samba on Linux Mint 21.2. Furthermore, you will be guided through a practical example of sharing files and resources using Samba.

How to Install and Configure Samba on Linux Mint 21.2?

The sequential steps given below will be utilized to install and configure the Samba, a sharing software, on Linux Mint 21.2.

Step 1: Linux Mint Release

The command will display brief information of the Linux Mint:

lsb_release -a

Step 2: Update Linux Mint Packages

The below command will keep your Linux Mint packages up to date:

sudo apt update

Step 3: Upgrade Linux Mint Packages

To upgrade your Linux Mint 21.2 and get the latest versions of installed applications, run this command in the terminal:

sudo apt upgrade -y

All the Linux Mint 21.2 package files are now upgraded with the latest versions.

Step 4: Install Samba Package

The command mentioned below will install the complete package of Samba on Linux Mint 21.2:

sudo apt install samba -y

Based on the above message mentioned in the screenshot, Samba has been installed along with its associated libraries and dependencies.

How to Configure Samba on Linux Mint 21.2?

The following instruction will be utilized to configure the Samba on your Linux Mint 21.2.

Step 1: Samba Status Check

Before jumping into the Samba configuration, you need to activate the Samba services. Here is the command:

sudo systemctl status smbd

The screenshot presented above indicates that the Samba is active and ready to use.

Step 2: Check Present Working Directory

The command “pwd” will display your current working directory:

pwd

As you can see, we are currently in the “/home/genie” location of the drive.

Step 3: Make Directory

In Linux operating systems, the “mkdir” command is used to create a directory/folder from the command line:

mkdir GenieShared

Here it can be seen that we have created an empty directory with the name “GenieShared”.

Step 4: List the “GenieShared”

Run the “ls” command from your terminal to show if the “GenieShared” has been created in the “/home/genie/”:

ls

You can see the “GenieShared” directory is present.

Step 5: Create a Password for the User

Using the following command will be run from the terminal to generate an authentication password against the user such as “genie”:

sudo smbpasswd -a genie

You have successfully created a new password for the “genie”.

Step 6: Edit Samba Configuration File

To open the Samba configuration file, the following command is attached for your reference:

sudo nano /etc/samba/smb.conf

Once you have entered the ‘smb.conf’ file, the Samba configuration file, scroll down to the end and add the script provided below. Save the file by pressing Ctrl+S and exit by Ctrl+X:

[GenieShared] 
path = /home/genie/GenieShared 
browseable = yes 
read only = no 
guest ok = yes

The script can also be examined in the above example.

Step 7: Restart Samba Services

Run the command presented below to restart the Samba services of your Linux Mint 21.2:

sudo systemctl restart smbd

The empty result indicates that Samba has restarted successfully.

Step 8: Display Your System IP Address

Using the below command will display the IP address of your Linux Mint 21.2:

ifconfig

As you can see, our Linux Mint is running on the IP “192.168.10.15”. Your IP may differ from this one, so replace it with your IP address.

How to Access the Samba Shared Directory from Ubuntu 22.04?

Here are a few steps that can be used to access the directory shared through Samba.

Step 1: Access “GenieShared” via IP Address

First of all, go to the “other Locations”. In the “Connect to Server” address bar, copy your system IP address and shared folder in the following pattern. Lastly, press the “Connect” button:

smb://192.168.10.15/GenieShared

In the below screenshot, you can see we have accessed the “GenieShared” directory, which was created in Linux Mint 21.2:

Step 2: Create a Test File

Using the “touch” command, create a test file:

touch GenieShared/smbdTest.txt

A “smbdTest.txt” file has been created without any error.

Step 3: Access the Test File in “GenieShared”

Copy the following command in the same manner and run from the “Connect to Server” address bar:

smb://192.168.10.15/GenieShared

The above snapshot shows that the test file with the name ‘smbTest.txt’ has been successfully accessed from Ubuntu 22.04.

How to Purge Samba from Linux Mint 21.2?

The following instructions will be followed to purge the Samba from Linux Mint 21.2.

Step 1: Purging Samba from Linux Mint 21.2

The command, attached below, will be used to remove the Samba package from your Linux Mint 21.2:

sudo apt purge samba -y

The above snapshot displayed the message that some files and directories were not removed.

Therefore, we need to run one more command from the Linux Mint 21.2 terminal to remove the remaining files.

Step 2: Remove the Remaining Files

Run the below-mentioned command from your terminal to remove the remaining files of the Samba package:

sudo apt autoremove -y

The above command removed the remaining files and directories associated with the Samba package.

Conclusion

In Linux Mint 21.2, Samba can be installed and configured with a few steps. Install it by executing the single line command “sudo apt install samba -y” from your terminal. You can further configure the Samba service using a customized script, granting other users access to the shared directory. Samba is software used for sharing purposes such as between Linux and Windows systems. With the help of this instruction-based article, you have learned the process of installation and configuration of Samba on Linux Mint 21.2.

Print Friendly, PDF & Email
Categories