Anytime you want to share some files over the network, NFS comes to mind. But what happens if you want Windows servers to be able to access those files as well? That's when you need Samba.

Follow those steps on the host that will act as a server:

1. Install the necessary packages:

yum -y install samba samba-client samba-common cifs-utils

2. Add a Linux user and set a password for Samba. In this case we call the user 'samba'.

useradd -s /bin/false samba
smbpasswd -a samba

3. We're going to use the directory /opt as the exported directory, so we need to set the directory owner to the 'samba' user:

chown -R samba:samba /opt

4. Enable the samba services on boot:

systemctl enable smb.service
systemctl enable nmb.service

5. Edit the main Samba configuration file: /etc/samba/smb.conf - delete all contents and replace them with:

[global]
 security = user
 passdb backend = tdbsam

[sambashare]
 read only = No
 locking = No
 path = /opt
 guest ok = No

6. Test your configuration with the 'testparm' command - you should see no errors

testparm

7. Restart the Samba services:

systemctl restart smb.service
systemctl restart nmb.service

8. (Optional) - If you are not using Windows, block the netbios ports!

# UDP ones first
iptables -A INPUT -p udp --dport 138 -j DROP
iptables -A INPUT -p udp --dport 137 -j DROP
iptables -A INPUT -p udp --dport 445 -j DROP
# Then TCP
iptables -A INPUT -p tcp --dport 139 -j DROP

Follow those steps on the host that will act as a client:

1. Install the necessary packages:

yum -y install cifs-utils
mount -t cifs -o user=samba -o pass=the_password_you_set_before //10.42.226.1/sambashare /media

2. Check that the mount shows up in df:

df -hT /media/
Filesystem Type Size Used Avail Use% Mounted on
//10.42.226.1/sambashare cifs 80G 1.2G 79G 2% /media

Sources: