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
After installing the Samba Start and enable the samba service with the following command:
# systemctl enable smb
# systemctl start smb
You can verify the Samba Service Status with the following command:
# systemctl status smb
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
Next Step, is to create a folder which has to share, I am giving the name of this folder common.
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
After that Restart the Samba Services, using the following command:
# systemctl restart smb
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
To allow samba services to access from other machines as well, add a firewall rule as shown below:
# firewall-cmd - - add-service=samba - - permanent
Reload the firewall using this command:
# firewall-cmd - - reload
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.