Tutorials we will learn samba server in Linux/centos 8 and sharing Directories between CentOS and Windows 10.
Samba share Directory between same and Different Operating System. it is a free and open-source protocol that allows files to be shared across networks. samba is a free and open-source operating system through which you can share files and data in Linux and Windows.
The (SMB) Server Message Block Protocol is a protocol communicating with server-client with the help of which you can share files, printers, etc. from the server to the network
samba server can perform some basic task
- you can share Linux Drive for windows across the network .
- Linux server printers can be used in windows.
- you can use windows printer in Linux Machine
Before configuring the samba server, make sure that Linux and Windows must be in the same workgroup. Use the following command to check the workgroup in Windows.
net config workstation

Check the samba package Install or not.
You check the smb package in your system, the package is installed or Not you can check the package status .

Install Samba and Necessary packages
if the package is not in your system install now you can install the package with the help of the below-given command.
sudo dnf install samba samba-common samba-client

After successfully installing the samba package, it’s time to make some configurations, First, we will create a Directory and give it a Necessary Permission And Ownership as follow.
mkdir /samba-share chmod -R 777 /samba-share chown -R nobody:nobody /samba-share $ sudo chcon -t samba_share_t /srv/samba/shared

samba configuration :
first, open the vim /etc/samba/smb.conf and then change some settings as below.
vim /etc/samba/smb.conf
[global] workgroup = WORKGROUP Host allow = 127 192.168.43. security = user map to guest = bad user [Samba-Share] path = /samba-share comment = share data between Centos And Windows writable = yes browsable =yes guest ok = yes

Save and close the configuration file and test the configuration file is correct or not, To check the configuration file run Bellow Command. testparm is a command where you can check the samba configuration file status.
testperm
[root@simi ~ ] # testparm

check Samba Services:
With the help of the following command, you can check the service of samba server and if the service is stopped then you can also start it.
[root@simi ~]# systemctl start smb root@simi~]#systemctl status smb [root@simi ~]# systemctl enable –now smb

firewall setting.
If you have a running firewall service in your system, then you have to allow samba’s service in the firewall, for that you can use the following command.
[root@simi ~]# firewall-cmd –add-service=samba –permanent [root@simi ~ ]# firewall-cmd –reload

Accessing Samba share from a windows machine
If you have properly configured your samba server and have configured the configuration file of samba properly, now you have to access the share file from the Windows machine that is connected across the network with the samba server. Open Windows run (window + R) and then write the ip of samba server with double slash as given below.
\\ hostname of samba server \\IP ADDRESS OF SAMBA SERVER



SHARE SECURE DIRECTORY From Samba Server
Like we have just learned, simply created and shared the directories and access everyone, delete it, modify it. If we want to share a very important document and access only a particular user That has been granted access permission.
Install Samba Necessary packages:

configure samba
After installing the package, create a group, Create directory and assign the necessary permissions and file ownership, add a new user to the newly created group,Set password to samba user that will be used when accessing the secured directory share
groupadd samba_group mkdir /secure_data chmod -R 770 /secure-data chgrp samba_group /secure-data useradd samaba-user001 smbpasswd -a samba-user001

samba configuration:
Open the main configuration file of samba append as below given.
vim
vim /etc/samba/smb.conf

save exit, restart and check samba service
systemctl restart samba systemctl enable --now smb systemctl status smb

again login into the Windows computer, go to run ( press windows key + R) then type.
\\hostname of samba server OR \\IP ADDRESS OF SAMBA SERVER

Click On OK

Enter the username and password that was created for the samba server



Conclusion
These Tutorials We learned about the samba server in linux/CentOS Step By steps hope that now you are comfortable with Samba Server. If your problem is still not solved share your Problem via comments.
