Ready to Start Your Career?

Create a SMB share on CentOS

kent 's profile image

By: kent

December 8, 2016

tessellation-greenDisable SELinuxFor the sake of simplicity and saving time, we will be disabling SELinux, which isn’t recommended. We urge you to learn how SELinux works and to set it up accordingly after getting samba working successfully.This will disable SELinux from being enabled on boot:vi /etc/selinux/configChange “SELINUX=enforcing” to “SELINUX=disabled”Run this to immediately disable SELinux without rebooting:setenforce 0Allows Samba Ports in IptablesChange to the subnet you wish to allow access to your samba serverIptables -A INPUT -s -p udp –dport 137 -j ACCEPTIptables -A INPUT -s -p udp –dport 137 -j ACCEPTIptables -A INPUT -s -p udp –dport 137 -j ACCEPTIptables -A INPUT -s -p udp –dport 137 -j ACCEPTService iptables saveInstall Sambayum install samba samba-client samba-commonSet Samba to start on bootchkconfig smb onchkconfig nmb onCreate a samba useruseradd sambagroupadd sambagroupusermod -a -G sambagroup sambaCreate the share directorymkdir /home/samba/privateGive the share directory the correct permissionschown -R samba:sambagroup /home/samba/privatechmod -R 0770 /home/samba/privateBackup the default smb configmv /etc/samba/smb.conf /etc/samba/smb.conf.bakEdit the smb configvi /etc/samba/smb.confAdd the following and adjust how you see fit:[global]workgroup = WORKGROUPsecurity = sharemap to guest = bad user[Secure]path = /home/samba/privatevalid users = @sambagroupguest ok = nowritable = yesbrowsable = yesStart Sambaservice smb startservice nmb start
Schedule Demo