How to install and configure Samba on CentOS 8
Samba is a free open source implementation of the Windows SMB protocol (CIVFS) that allows us to easily and easily share files, folders, and printers between Linux and the Windows operating system. It uses TCP port 445.
In this guide, I’ll show you how to install and configure Samba on CentOS 8.
Install Samba packages
To install samba packages on CentOS 8, open a terminal and enter the following command:
# dnf install –y samba samba-common samba-client
After installing Samba, start and enable the samba service with the following command:
# systemctl enable smb
# systemctl start smb
You can check the status of the Samba service with the following command:
# systemctl status smb
Samba setup
Once the installation is complete, it’s time to configure Samba. But before doing that, make a copy of the original config file using the following command:
# cp /etc/samba/smb.conf /etc/samba/smb.conf.bk
The next step is to create a folder that needs to be shared, I name this folder. general…
Advertising
After creating the folder, navigate to the config file and configure Samba and resolve the newly created directory to be shared 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 this user a member of that group so that he 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 group Vitux, confirm that the user is added to the group or not? To do this, use the following command:
# grep ‘vitux’ /etc/group
To allow samba services to be accessed from other machines, add a firewall rule as shown below:
# firewall-cmd - - add-service=samba - - permanent
Reload the firewall with this command:
# firewall-cmd - - reload
Accessing the Samba folder from a Windows computer
To access samba share from Windows, click Windows Key + R launch Run Dialogue. Enter IP address or hostname and press To come in…
You will be prompted for your samba credentials, enter your credentials and click OK…
After a successful login, the public directory becomes available and available for use, as shown in the figure:
Accessing the Samba folder from a Linux machine
To access Samba shares from another Linux machine, open GNOME file manager and click Connect to server as it shown on the picture:
Enter the IP address of your Samba server and click Connect. You will be prompted to enter your Samba credentials to use Public directly, enter your Samba credentials, you can now see Are common folder is available.
Conclusion
In this tutorial, we learned how to set up a Samba server to CentOS 8… We have created a shared directory accessible over the network from Linux and Windows systems. We also saw how to set up a firewall so that we can access the Samba file server from other machines.
How to install and configure Samba on CentOS 8