How to Install Samba on Linux Mint

Samba is a free software suite that enables seamless file sharing between Linux, Windows, and macOS systems. In this tutorial, we'll explain how to install Samba on Linux Mint, one of the most popular Linux distributions with a user-friendly interface.

Prerequisites

Before we begin, ensure that you have the following:

Step 1: Update your System

First, open the terminal and update the system packages list with the command:

sudo apt-get update

This command ensures that your system has the latest package information from the repositories.

Step 2: Install Samba

To install Samba on Linux Mint, execute the following command in the terminal:

sudo apt-get install samba

This command installs the Samba package along with all the related dependencies.

Step 3: Configure Samba

After installing Samba, we need to create a shared directory and configure Samba to allow user access. To create a directory, execute the following command in the terminal:

sudo mkdir /home/samba_share

Now, let's assign directory ownership to the Samba usergroup:

sudo chgrp sambashare /home/samba_share

Next, let's update the directory permissions:

sudo chmod 2770 /home/samba_share

This command sets the directory permissions so that all group members can read, write, and execute within the directory.

Next, we need to update the Samba configuration file located at /etc/samba/smb.conf. We'll use nano text editor to modify the configuration file:

sudo nano /etc/samba/smb.conf

Add the following lines to the end of the configuration file:

[samba_share]
   comment = Samba Share
   path = /home/samba_share
   browseable = yes
   guest ok = no
   read only = no
   create mask = 0775

This configuration creates a new share named samba_share with the specified directory path and options such as browsing, read-only access, and permission masks.

After making changes, save the file and exit from the editor by pressing Ctrl+X, then press Y and Enter to confirm the file changes.

Step 4: Add Samba User

To access files and folders shared through Samba, we need to add Samba users. You can add an existing Linux user as the Samba user or create a new one exclusively for Samba. To add a new user, execute the following command in the terminal:

sudo smbpasswd -a username

Here, replace the "username" with the name of the Linux user.

Enter a password when prompted to set up a user account for Samba.

Step 5: Restart Samba

After making all configuration changes, we need to restart the Samba service to apply the changes:

sudo systemctl restart smbd.service

Step 6: Access Samba Share from Windows

To access the Samba share from a Windows system, open File Explorer on your Windows computer, then enter the Linux Mint system's hostname or IP address in the address bar in the following format:

\\hostname_or_ip_address\samba_share

Here, replace "hostname_or_ip_address" with the actual hostname or IP address of your Linux system.

Enter the Samba user credentials when prompted and hit Enter. You can now browse, read, write or delete files in the shared folder.

Conclusion

In this tutorial, we have explained how to install and configure Samba on Linux Mint. With Samba installed, you can easily share files between Linux and Windows systems with ease.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!