How to install and configure Samba Share in Rocky Linux 8.6

To Install And Configure Samba Share In Rocky Linux 8.6

Introduction

Samba is an important component to seamlessly integrating Linux/Unix servers and desktops into active directory environments. It can perform both as a domain controller and as a regular domain member.

Installation Procedure:

Step 1: Check the OS version by using the below command

root@linuxhelp ~]# cat /etc/os-release 
NAME="Rocky Linux"
VERSION="8.6 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.6 (Green Obsidian)"
ANSI_COLOR="0;32"

Step 2: Install the Samba Server by using the below command

[root@linuxhelp ~]# yum -y install samba*
Rocky Linux 8 - AppStream                                         3.0 MB/s | 8.8 MB     00:02    
Rocky Linux 8 - BaseOS                                            1.1 MB/s | 3.6 MB     00:03    
Rocky Linux 8 - Extras                                            7.4 kB/s |  11 kB     00:01    
Package samba-client-libs-4.15.5-5.el8.x86_64 is already installed.
Package samba-common-4.15.5-5.el8.noarch is already installed.
Package samba-common-libs-4.15.5-5.el8.x86_64 is already installed.
Dependencies resolved.


==================================================================================================
 Package                            Architecture   Version                Repository         Size
==================================================================================================
Installing:
 samba                              x86_64         4.15.5-8.el8_6         baseos            867 k
 samba-client                       x86_64         4.15.5-8.el8_6         baseos            714 k
 samba-common-tools                 x86_64         4.15.5-8.el8_6         baseos            521 k
 samba-krb5-printing                x86_64         4.15.5-8.el8_6         baseos            101 k
 samba-libs                         x86_64         4.15.5-8.el8_6         baseos            174 k
 samba-pidl                         noarch         4.15.5-8.el8_6         baseos            199 k

Step3: Enable the samba service by using the below command

[root@linuxhelp ~]# systemctl enable smb
Created symlink /etc/systemd/system/multi-user.target.wants/smb.service → /usr/lib/systemd/system/smb.service.

Step4: Start the samba service by using the below command

[root@linuxhelp ~]# systemctl start smb

Step 5: Check the status of Samba service by using the below command

[root@linuxhelp ~]# systemctl status smb
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-07-01 04:30:42 EDT; 9s ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 40625 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 4 (limit: 17274)
   Memory: 13.1M

Step 6: Add firewall by using the below command

[root@linuxhelp ~]# firewall-cmd --add-service=samba --permanent 
success

Step 7: Reload the firewall by using the below command

[root@linuxhelp ~]# firewall-cmd --reload 
success

Step 8: Disable SELinux by using the below command

[root@linuxhelp ~]# setenforce 0

Step 9: Create Configuration to access Samba by using the below command

[root@linuxhelp ~]# vim /etc/samba/smb.conf
[samba]
       path = /share
       comment = samba
       browseable = yes
       writable = yes
       guest ok = yes
       read only = no

Step 10: Create a Directory in root by using the below command

[root@linuxhelp ~]# mkdir /share

Step 11: Grant permission to the directory by using the below command

[root@linuxhelp ~]# chmod 777 /share/

Step 12: Create a file in samba share Directory by using the below command

[root@linuxhelp ~]# touch /share/test

Step 13: Create a user by using the below command

[root@linuxhelp ~]# useradd sambauser

Step 14: Add the normal user to Samba user by using the below command

[root@linuxhelp ~]# smbpasswd -a sambauser
Retype new SMB password:
Added user sambauser.

Step 15: Restart the Samba service by using the below command

[root@linuxhelp ~]# systemctl restart smb

Step 16: Go to windows machine click windows + R to Run and Enter your IP address as shown in the below image

Step 17: Enter the Samba user name and password as shown in the below image

Step 18: The samba share works as shown in the image below

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install and configure Samba share in Rocky Linux 8.6. Your feedback is much welcome.

FAQ
Q
Is Samba printer sharing support Windows and Linux?
A
yes, its work in both environment.
Q
What is the latest version of Samba?
A
15 is the latest version which is lastly released on September 20, 2021.
Q
What is the definition of SMB?
A
Server Message Block.
Q
What is the protocol used by Samba?
A
SMB/CIFS protocols.
Q
Is Samba free of cost?
A
Samba is an open source software, released under the GPL license.