Get 50% Discount Offer 7 Days


Contact Info

Chicago 12, Melborne City, USA

+88 01682648101

[email protected]

Recommended Services
Supported Scripts
Top way to Setup samba on Ubuntu 22.04

Have you ever heard about Samba? Here, we will briefly introduce this software and present the top way to Setup Samba on Ubuntu 22.04. Samba is actually a software by which users can access all files, resources, or printers that exist jointly in the network or Internet of companies and other cases. The best feature that can be mentioned about this tool is that Samba is available in the repositories of almost all Linux distributions and is easy to install.

What Is Samba?

Samba software is a free and open-source implementation of the SMB protocol used to integrate servers and desktops that are equipped with Linux or Unix systems and are located in environments with Microsoft’s active directory service. Another function of this software is to be used as a controller for the domain or as a normal member.

Samba software uses common SMB/CIFS protocols. CIFS is an open-type protocol of SMB. That is, if your programs are compatible with SMB or CIFS, they can communicate with a Samba server. Some Linux desktops have a Samba client by default. The Samba client is called smbclient.


There are some requirements before you start your installation process:

– A Linux VPS with the Ubuntu OS

– Root access or Sudo privileges

Steps to Setup Samba on Ubuntu 22.04

Here, we are going to show how to install and setup Samba on Ubuntu. So, follow the instructions below:

Installing Samba on Ubuntu 22.04

If you want to install Samba on Ubuntu, first of all, you should update your system to the last version. Use this command to run the system update:

sudo apt update

In your next step, use the APT package manager in your command line to start the installation process. The installation package already exists on your system repository so you don’t need to add anything more:

sudo apt install samba

Now, check the status using the following command:

systemctl status smbd --no-pager -l

The following command will help you to make the service enabled to start the program automatically:

sudo systemctl enable --now smbd

Configuring Samba and Samba User

To do the configuration of Samba on the Ubuntu operating system, use the command below:

nano /etc/samba/smb.conf

Then find the Workgroup line and replace it with your own group:

replacing workgroup on samba

Configuring the Firewall to Allow Samba in Ubuntu 22.04

To be able to access files shared via the SMB protocol, you must whitelist and allow the service in the firewall, outside of the computer. To do this, apply the following command:

sudo ufw allow samba

Adding User to the Samba Group

To add the current user to the Sambashare group, apply the command below and access all files and folders shared:

sudo usermod -aG sambashare $USER

Now, you should set a password for share. Note that, this one should be different from the system password:

sudo smbpasswd -a $USER 

$USER is your current user, but if you want to replace another user, you can change this one with your own user. The shared files or folders should be accessible to that particular user.

As an alternative, you can use the commands below to add users to Sambagroup:

sudo usermod -aG sambashare your-user

Then to set a password use:

sudo smbpasswd -a your-user

Setup Samba on Ubuntu to Share Files

As you configured the user to use Samba, you can test it using the instructions below. e.g. sharing a picture folder. Find your desired folder and right-click on it. Choose the Properties and then Local Network Share:

testing sharing file on samba - Setup Samba on Ubuntu

If you want to delete or create files from the shared directory, you should mark the box for Allow others to create and delete files in this folder. To log in or access the shared folder you can select the Guest Access option. In the end, to create the sharing point, click on Create Share:

network share folder on samba - Setup Samba on Ubuntu

As soon as you see the following message on your screen, click on the “Add the permissions automatically“:

add permissions message on samba

To access the remotely shared folder on Ubuntu 22.04, we will use Debian. Also, you can use Windows or MacOS:

– Go to File Manager and select Other Locations.

– Then type your Ubuntu 22.04 Samba IP address in the format below:


– You should replace ip-address with the samba server IP and Shared-folder-name with the folder you shared before:

access the remotely shared folder on samba

Now you will enter the credentials. Here, you should select the Registered User and give the Username and Password which is set to use in Samba:

insert credentials of samba - Setup Samba on Ubuntu

Now, you will have all the content of the remote Ubuntu through the Samba protocol:



This article was prepared to show how to install and setup Samba on Ubuntu 22.04. We also thought about how you can set the firewall to use the software. This implementation is a useful utility that can help in sharing different files and folders. Study this content carefully and enjoy using it. If you have any questions, please live a comment.


What is the directory of the Samba config file?

The main directory is /etc/samba/smb. conf for the configuration file.

What is the difference between Samba and NFS?

NFS is used for Unix-based systems and is good for faster file sharing. Samba is a Windows-based software that gives file and print services.

Rate this post
Share this Post

Leave a Reply

Your email address will not be published. Required fields are marked *