How to Install Samba on Ubuntu 18.04 Bionic Beaver

Install Samba on Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure Samba on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Samba is a free and open-source re-implementation of the SMB/CIFS network file-sharing protocol that allows end users to access files, printers, and other shared resources.


  • Operating System with Ubuntu 18.04
  • Server IPv4 Address with Superuser Privileges (Root Access)
  • Gnome Terminal for Linux Desktop
  • PuTTy SSH client for Windows or macOS
  • Powershell for Windows 10/11
  • Familiar with APT Commands

Install Samba on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Installing Samba.

Install the Samba package with the following command:

sudo apt install samba

Run the below command to checking if the installation was successful:

whereis samba

The following should be its output:

samba: /usr/sbin/samba /usr/lib/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz /usr/share/man/man8/samba.8.gz

Step 3. Configuring Global Samba Options.

Now that Samba is installed, we need to create a directory for it to share:

mkdir /home/<username>/sambashare/

To run this command change your username to your actual username. This command will create a directory named sambashare.

After that, you have to edit the configuration file which is located at /etc/samba/smb.conf:

sudo nano /etc/samba/smb.conf

At the bottom of the file, add the following lines:

    comment = Samba on Ubuntu
    path = /home/username/sambashare
    read only = no
    browsable = yes

What we added in Config:

  • [sambashare]: The name inside the brackets is the name of our share.
  • comment: A brief description of the share.
  • path: The directory of our share.
  • read only: Permission to modify the contents of the shared folder is only granted when the value of this directive is no.
  • browsable: When set to yes, file managers such as Ubuntu’s default file manager will list this share under “Network” (it could also appear as browseable).

Now that we have our new share configured, save it and restart Samba for it to take effect:

sudo systemctl restart nmbd

Step 4. Setting User Accounts and Connecting to Share.

Samba does not use system user accounts so we have to create samba accounts to share files with others. To create user run the following command:

sudo smbpasswd -a yourusername

Step 5. Connecting to Share.

Open up the default file manager and click Connect to Server then enter:

Install Samba on Ubuntu 18.04

That’s all you need to do to install Samba on Ubuntu 18.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.