0 3 min read
| Published on: June 12, 2022 | Last updated on: July 31, 2023

1. Overview

A Samba file server allows file sharing over a network between multiple operating systems. It allows you to share files with Windows and macOS users and access your desktop files from a laptop.

This guide covers the installation and configuration of Samba on Ubuntu.

What you’ll learn

  • How to set up a Samba file server
  • How to share files across a local network

What you’ll need

  • Ubuntu 16-21.04 LTS
  • A Local Area Network (LAN) to share files over

If you have everything ready, let’s dive straight into the installation process on the next step!

2. Installing Samba File Share server

To install Samba, we run:

sudo apt update
sudo apt install samba

We can check if the installation was successful by running:

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

Now that Samba has been installed, we need to make a directory that it can share with other computers:

mkdir /home/<username>/sambashare/

The command that you just ran creates a new folder in our home directory called sambashare. We will share this folder later.

The file that is used to configure Samba may be found in the /etc/samba/smb.conf directory. Editing the file in the following manner allows us to make the new directory available for sharing:

sudo nano /etc/samba/smb.conf

Add the lines that are shown below at the very end of the file:

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

Then, to save your work and leave the nano text editor, hit the Ctrl-S and Ctrl-X keys simultaneously.

What we’ve just added

  • comment: A brief description of the share.
  • path: The directory pertaining to our shared files.
  • read only: Only when the value of this directive is set to “no” is the user permitted permission to make changes to the contents of the shared folder.
  • browsable: If set to yes, file managers like Ubuntu’s default file manager will list this share under “Network” (it could also seem to be accessible).

Now that our new share has been set up, let’s save the configuration and restart Samba so that it can take effect.:

sudo service smbd restart

Modify the firewall rules so that Samba traffic can get through:

sudo ufw allow samba

4. Creating User Accounts and Establishing a Connection to the file share

Because Samba doesn’t use the password for the system account, we need to set up a password specifically for our user account in Samba:

sudo smbpasswd -a username

In order to be saved, the username entered must be associated with a system account.

Establishing a Connection with the Share server

On Ubuntu: Launch the file manager that is installed by default, click the Connect to Server button, and then enter:

On macOS: In the Finder menu, click Go > Connect to Server then enter: macosctn

On Windows, open up File Manager and edit the file path to:


Note: ip-address is the Samba server IP address and sambashare is the name of the share.

You’ll be prompted for your credentials. Enter them to connect! 



Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

Copyright @2022-2024 All Right Reserved – PCPlanet

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. You understand and give your consent that your IP address and browser information might be processed by the security plugins installed on this site. By clicking “Accept”, you consent to the use of ALL the cookies.
Accept Read More

Privacy & Cookies Policy