Samba is a free and open-source implementation of the Windows SMB (CIVFS) protocol that allows us to share files, folders, and printers between Linux and Windows Operating System simply and seamlessly.

In this tutorial, I will show you how to install and configure Samba on CentOS 8.

Install Samba packages

To install samba packages in centOS 8, open up the terminal and type the following command:

# dnf install –y samba samba-common samba-client

How to Install and Configure Samba on CentOS 8 centos linux shell

After installing the Samba Start and enable the samba service with the following command:

# systemctl enable smb

How to Install and Configure Samba on CentOS 8 centos linux shell

# systemctl start smb

How to Install and Configure Samba on CentOS 8 centos linux shell

You can verify the Samba Service Status with the following command:

# systemctl status smb

How to Install and Configure Samba on CentOS 8 centos linux shell

Configuring Samba

After the installation is completed, it’s time to configure Samba. But before that, make a copy of Original configuration file using the following command:

# cp /etc/samba/smb.conf /etc/samba/smb.conf.bk

How to Install and Configure Samba on CentOS 8 centos linux shell

Next Step, is to create a folder which has to share, I am giving the name of this folder common.

How to Install and Configure Samba on CentOS 8 centos linux shell

After creating the folder, let’s go to the configuration file and Configure Samba and allow the newly created directory which has to share as shown in the figure.

# vim /etc/samba/smb.conf

How to Install and Configure Samba on CentOS 8 centos linux shell

After that Restart the Samba Services, using the following command:

# systemctl restart smb

How to Install and Configure Samba on CentOS 8 centos linux shell

Now create a user and Group and make that user member of that group so they can use the samba service, using the following commands:

# useradd user1
# passwd user1
# smbpasswd –a user1
# groupadd vitux
# usermod –aG vitux user1

After adding user1 to group vitux, confirm that the user is added to a group or not? For this use following command:

# grep ‘vitux’ /etc/group

How to Install and Configure Samba on CentOS 8 centos linux shell

To allow samba services to access from other machines as well, add a firewall rule as shown below:

# firewall-cmd - - add-service=samba - - permanent

How to Install and Configure Samba on CentOS 8 centos linux shell

Reload the firewall using this command:

# firewall-cmd - - reload

How to Install and Configure Samba on CentOS 8 centos linux shell

Accessing the Samba Folder from Windows Machine

To access samba share from windows press Windows Key R to launch Run Dialogue. Enter the IP address or Hostname and press Enter.

How to Install and Configure Samba on CentOS 8 centos linux shell

It will prompt you to enter samba credentials, enter your credentials, and press OK.

How to Install and Configure Samba on CentOS 8 centos linux shell

After successfully logged in, a public directory is accessible and available for use as shown in the figure:

How to Install and Configure Samba on CentOS 8 centos linux shell

Accessing the Samba Folder from Linux Machine

To access the Samba shares from other Linux machine, open the GNOME file manager and click on Connect to Server as shown in the figure:

How to Install and Configure Samba on CentOS 8 centos linux shell

Provide your Samba Server IP address and click on Connect, you will be prompted to enter your Samba credentials to use Public directly, provide samba credentials now you can see Common folder is accessible.

How to Install and Configure Samba on CentOS 8 centos linux shell

Conclusion

In this tutorial, we learned how to configure a Samba Server on CentOS 8. We created a shared directory that is accessible over the network from Linux and Windows systems. We also saw how to configure the firewall so we can access the Samba file server from other machines.