In this guide, we are going to show Linux users how to install and configure Samba for sharing files on Linux Mint 20. Samba is an open-source implementation of the Server Message Block (SMB) and Common Internet File System (CIFS) protocols that provides file and print services between clients across various operating systems. Samba makes it possible to share files between Linux and Windows operating systems. In our case here, Linux Mint 20 will be Samba server.

Step 1: Install Samba on Linux Mint 20

We start by installing required samba packages on Linux Mint 20. This is done using apt command line package manager.

sudo apt-get -y update
sudo apt-get -y install samba

Step 2: Configure Samba share on Linux Mint 20

Samba configuration file is located in /etc/samba/smb.conf. Any changes made to this file requires Samba daemon to be restarted. Let’s start by creating a directory to be shared with Samba. The directory must exist before it can be configured in smb.conf. Let’s create one under /home and allow it to be readable and writable by all users.

$ sudo mkdir -p /home/share
$ sudo chmod 777 /home/share

Now open Samba configuration file to make the necessary changes.

$ sudo vim /etc/samba/smb.conf

Ensure you have the content as shown under global settings.


# Configure correct UTP 
 unix charset = UTF-8 
# Change this to the workgroup/NT-domain name your Samba server will be part of 
  workgroup = WORKGROUP 
  server min protocol = NT1
  ntlm auth = yes
  #interfaces = eth0 
  bind interfaces only = yes 

# Set share configuration at the end 
  path = /home/share 
  writable = yes 
  guest ok = yes 
  guest only = yes 
  create mode = 0777 
  directory mode = 0777

Configuration details:

  • Docs – Samba share name
  • path = /home/share – Directory to share
  • guest ok = yes – Turn on guest share
  • guest only = yes – All protected as guests
  • writable = yes – Set share directory as writable
  • create mode = 0777 & directory mode = 0777 – Allow access to all

Step 3: Configure Secure Samba Share (Recommended Way)

We need to give group ownership to Samba shared directory to sambashare group.

$ sudo chgrp sambashare /home/share

Now create samba share user, replacing user1 with your user name

$ sudo useradd -M -d /home/share/user1 -s /usr/sbin/nologin -G sambashare user1
$ sudo mkdir /home/share/user1
$ sudo chown user1:sambashare /home/share/user1
$ sudo chmod 2770 /home/share/user1
$ sudo smbpasswd -a user1
$ sudo smbpasswd -e user1

We created a user’s home directory inside Samba share parent directory and set ownership to the samba share group. Let’s create another user.

$ sudo useradd -M -d /home/share/smbadmin -s /usr/sbin/nologin -G sambashare smbadmin
$ sudo mkdir /home/share/smbadmin
$ sudo smbpasswd -a smbadmin
$ sudo smbpasswd -e smbadmin
$ sudo chown smbadmin:sambashare /home/share/smbadmin
$ sudo chmod 2770 /home/share/smbadmin

Configure secure sambashare

Open samba configuration file and add the following contents.

$ sudo vim /etc/samba/smb.conf

Add the following content at the end of the file

path = /home/share/user1
readonly = no
Browseable = no
force create mode = 0660
force directory mode = 2770
valid user = @user1 @sambashare
path = /home/share/smbadmin
readonly = no
Browseable = no
force create mode = 0660
force directory mode = 2770
valid user = @smbadmin @sambashare

Save the file and restart Samba daemon

$ sudo systemctl restart smbd nmbd

Allow Samba through the firewall

$ sudo ufw allow samba

Step 4: Configure Samba client.

To be able to access Samba share directory from another machine, we need to install Samba client. I am going install Samba client on Elementary OS.

sudo apt-get install samba-client cifs-utils

To access Samba share temporarily, run the command with syntax as shown below:

$ smbclient //sambaserver-ip/share-dir -U sambauser

For example in my case,

$ smbclient // -U user1

Mount the Samba share to a directory for permanent access.

$ sudo mkdir -p /mounts/shares
$ sudo mount -t cifs -o username=user1 // ~/mounts/shares

Check if the directory is mounted on the client

$ df -h

Output should be as shown:

To enable persistent mount even on reboot, mount the samba share in fstab file

$ sudo vim /etc/fstab

Add the following line depending on your mount point.

//  /mnt/shares cifs credentials=/.sambacreds 0 0

Save the file and exit the create the credentials file.

$ sudo vim /.sambacreds

Add the credentials information

username: user1
password: yourpassword

Confirm if mounted

$ sudo mkdir -p /mnt/shares 
$ sudo mount -a 
$ df -hT | grep cifs
// cifs      20G  14G  6.3G  69% /mnt/shares

You have successfully set up Samba file share on Linux Mint 20 and mount the shared directory on a client. Check more guides below:

Linux Learning courses:


  1. When I followed these instructions, setting up a linux mint 20 system in mid Dec this year, I ran into some problems with the NT1 setting in “server min protocol = NT1” in /etc/samba/smb.conf. I believe it has something to do with a bug in samba 4.01. When trying to save a sample.txt file it was somehow recognized as a folder instead of as a file. Changing from NT1 to SMB3 seems to have cured the problem except that I cannot get rid of the sample.txt folder. Nemo shows it as folder name, but gives an error when trying to delete it. In addition saving an edited /etc/samba/smb.conf and running “sudo systemctl restart smbd nmbd” failed to restart samba correctly. I had to reboot the system in order to get the “server min protocol = SMB3” recognized. I appreciate this posting, because I have suffered headaches trying to get samba up and running on earlier versions of Mint, but you might want to update this posting.


Please enter your comment!
Please enter your name here