Install Samba Server
Samba is available from the standard CentOS repositories. To install it on your CentOS system, run the following command:
Once the installation is completed, start the Samba services and enable them to start automatically on system boot:
The smbd service provides file sharing and listens on TCP ports 139 and 445. The nmbd service provides NetBIOS over IP services to clients and listens on UDP port 137.
Configure Firewall Settings
Now that Samba is installed and running on your CentOS machine, you'll need to configure your firewall settings and open the necessary ports. To do so, run the following commands:
Configure File Share
We will be using a currently existing user for this share. Set an SMB password for it with the following command:
Create the directory to be shared:
Let's create a backup of our /etc/samba/smb.conf file in the event that we make an error:
Now let's edit /etc/samba/smb.conf.
Append the following to the end of the file:
Now let's restart Samba services and test our settings with testparm:
Now let's connect to our new remote share from a client machine!
You may encounter the following error on a current CentOS 7 implementation:
To fix this, login as root and run the following command:
Conclusion
This was pieced together with a couple of different tutorials/articles and some trial and error. It is by no means a complete faq, and leaves out a lot of best practices, but will get a share up and running if you just need to transfer a couple of files to a virtual machine or the like. Thanks for reading!
Sources: