How to Install Samba Server on Rocky Linux and AlmaLinux

In this blog post we will learn How to Install Samba Server on Rocky Linux and AlmaLinux with detailed steps followed by testing it with Linux and Windows Client.

Introduction

Samba is a well-known open-source file-sharing program that enables users to share network resources needed to do their activities. It is a re-implementation of the widely used network file and print sharing SMB (server message block) protocol. Shared resources are stored and accessible from a Linux or Windows client when Samba is installed on a central Linux server.

Pre-requisite

  • Host installed with Rocky Linux 8 or 9. You may also have the AlmaLinux 8 or 9. Refer How to install Rocky Linux
  • User with sudo privileges
  • Windows client node.

Host preparation

To get started, first make sure that all of the packages are the most recent versions and that our server is up to date. Use the following command to do this.

Reboot your system if the upgrades included the kernel packages

Installing Samba Server

The default package repositories for Alma/Rocky Linux contain the samba packages. Run the given command to install them.

The command installs the dependencies shown in the output together with the packages that were requested. When the installation is finished, you will receive a list of all the packages that were installed successfully.

Samba User and Group Creation

Samba allows for both public and private shares, with unrestricted access to the shares. We will set up Samba in this part such that it shares a secure directory that is accessible to authorized users only.

Create a user for the samba

Set a password for the user

The newly established group will then have the new Samba user added to it, as indicated:

A samba share is a directory that network client computers will share. As a result, we will establish a directory as indicated.

To make the directory we just made accessible, we will now grant it ownership and permission.

Samba Configuration

Now its time to configure the samba default configuration file. We will have a backup of original file in case if something goes wrong we should be able to restore back.

Now let us open the file in the editor

To control who has access to the Samba share, add the following settings to the configuration file.

Save and exit the file once you its completed.

Verify the configuration file using the below command

Allow the Firewall

Allow the Samba protocol on the firewall in order to allow remote machines to access samba shares.

Enable & restart the Service

Let us enable and start the Samba Services

Accessing SAMBA from Linux Client

The Samba client application has to be installed in order for a Linux client to access the file system. To install the software on your Linux machine, use the following command:

Access the share using the below command and authenticate using the credentials of the Samba user.

Accessing SAMBA from Windows Client

Press the Windows Key + R on a Windows client to bring up the Run dialog and access the share from this destination.

In the designated space, type your server’s IP address or hostname as follows:

To access the folder, you will have to authenticate using the credentials of the Samba user. After entering the user’s password and username from the previous step, click “OK.” You will now see the Folders in the share where you can read write as per your requirements.

Conclusion

After following this tutorial, you now know how to install Samba server on Rocky Linux and AlmaLinux followed by accessing it from Linux as well as Windows Client. For more details refer to Official Samba

Leave a comment