Samba is a free software that provides a standard Windows interoperability suite of programs for Linux and Unix. It uses SMB (Server Message Block) protocol which is a network file and resource sharing protocol that uses a client-server model which makes Samba seamlessly integrate Linux/Unix Servers and Desktops into Active Directory environments.

It provides secure, stable, and fast file transfers for all clients using SMB/CIFS protocol like Windows and Linux.

The point to note is that CIFS (Common Internet File System) is sometimes interchangeably used to refer to SMB. This is because it was a common Microsoft SMB introduced in Windows 95.

SMB Share

It is also known as SMB file share, it is simply a shared resource that is set up on an SMB network with respect to the Unix directories. A good example to understand is to picture network printers that are shared using SMB. In Windows, these SMB shares appear like normal Windows Accessible folders on the network while Unix users can choose to mount the shares using mount.cifs command or use a utility like smbclient to read the shares.

Samba includes SWAT(Samba Web Administration Tool) which is the graphical management tool that can be used to set up Samba through a web browser.

In this Guide, I will show you how to

  • Install Samba on KDE Neon
  • Configure Samba file server on KDE Neon
  • Connect to a Samba Share from Windows and Linux

Prerequisites: Make sure you are logged in as a user with sudo privileges

Install Samba on KDE Neon/Kubuntu

First, update the package index with and perform upgrades for installed packages:

sudo apt update
sudo apt upgrade

Then continue to install samba using

sudo apt install samba

Type Y when prompted with the disk space the software will use to continue the installation

We can check if the installation was successful by using

whereis samba

It should show such an output

To check whether samba is running

sudo systemctl status smbd

The output should resemble something like this. Use q to exit

Configuring Samba on KDE Neon/Kubuntu

Now that Samba is up and running, We have to create a directory for it to share

mkdir $HOME/sambashare/

Replace the username with your username. sambashare is the file that we will share and it is located in /home/$USER directory

Let us add a file in our directory.

cd $HOME/sambashare/
touch file1.txt

Use ls to list the contents on the directory.

The configuration file for Samba is located at /etc/samba/smb.conf. Before we edit the file, we should create a backup.

Navigate back to your home directory by using cd .. Then move the config file to another file with a different file extension.

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.backup

We will then create a new configuration file to add the new directory as a share. We will open it with an editor like nano or vim.

sudo nano /etc/samba/smb.conf

Add this command to the file

[sambashare]
    comment = Samba on Ubuntu
    path = /home/annkamau/sambashare
    read only = no
    browsable = yes

Replace my username with yours. Save your work by using ctrl-x to exit then press Y to save the file then Enter to exit the editor.

To view the configurations made, Use the following command

sudo testparm

It will list the file contents as follows

Restart Samba

sudo service smbd restart

This will enable the changes to take effect

To allow Samba traffic, update the firewall rules

sudo ufw allow samba

The output looks like this

Setting up user account

Use a username that belongs to the system account.

sudo smbpasswd -a annkamau

Then type in a password that you will use to connect to the samba share

Connecting to Samba share from Windows

We will use your system’s IP address to connect. to find it use

$ ip a 

The output will show as below

Go to your Windows System and open RUN by using Windows key + R. Type your IP address.

\\ip-address\sambashare

Put your IP address

It will open a window to put in your credentials.

Then if you open the folder, You will find the file we created.

Connect to Samba Share form Linux system

Install samba client packages:

# RHEL based systems
sudo yum -y install samba samba-client cifs-utils

# Debian based systems
sudo apt update
sudo apt install smbclient

In Linux, Open the default file manager and on the search bar enter his

smb://ip-address/sambashare

Remember to replace your IP address with yours.

It will then prompt you for the authentication credentials

Which will then open the directory with the file as follows.

Mounting using command line

Create directory where samba share is to be mounted:

sudo mkdir  /mnt/backups

Interactive terminal mount;

smb://ip-address/sambashare
mount -t cifs -o user=samba_user1,password=userpassword //ip-address/sambashare  /mnt/backups

Syntax for automatic mounting using/etc/fstab

//ip-address/sambashare /mnt/backups  cifs  user=samba_user1,password=userpassword,soft,rw  0 0

Conclusion

In this tutorial, You have learned how to install samba on KDE Neon. Set a user and configure the samba config file with certain parameters. You also learned how to connect to the samba share from Windows and Linux.

More guides on Kubuntu / KDE Neon:

LEAVE A REPLY

Please enter your comment!
Please enter your name here