I recently set up a samba server myself for a college assignment on a CentOS system, which is a clone of RedHat, and I documented my steps, I'll share them with you.
1) install samba and set it to start automatically after every reboot
# yum install samba
# chkconfig --level 2345 smb on
2) open up the appropriate ports in the firewall
# iptables -I INPUT 1 -p udp --dport 137 -j ACCEPT
# iptables -I INPUT 1 -p udp --dport 138 -j ACCEPT
# iptables -I INPUT 1 -p tcp --dport 139 -j ACCEPT
# iptables -I INPUT 1 -p tcp --dport 445 -j ACCEPT
# iptables -I INPUT 1 -p udp --dport 445 -j ACCEPT
# service iptables save
# service iptables restart
Why so many ports? The smb protocol depends on a lot of stuff, including Netbios, which is Microsoft's way of tying computer names to an IP address.
3) the /etc/samba/smb.conf configuration file
The assignment required I shared 2 folders, one read-only, and one with writing permissions.
I also had to secure the /shares/Public/upload folder so only the user "student" could access and write in it.
If you want to use password authentication too, you have to add a user to samba (substitute student with your user name):
#smbpasswd –a student
Code:
# vi /etc/samba/smb.conf
#======================= Global Settings======================
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
netbios name = NAS
hosts allow = 127. 10. 168.
security = user
passdb backend = tdbsam
#====================== Share Definitions =====================
[Public]
comment = Public
path = /shares/Public
public = yes
guest ok = yes
writable = no
printable = no
[upload]
comment = upload
path = /shares/Public/upload
public = yes
guest ok = no
writable = yes
printable = no
valid users = student
The lines "security = user" and "passdb backend = tdbsam" make sure you need to log in with a valid user account to access the share.
The line "valid users = student" makes it so only student can access that particular share.
4) SELinux settings
This is emportant, RedHat systems use Security Enhanced Linux, and it won't just let samba share folders without direct orders from root.
(make sure to replace the "/shares" part with the folder you want to share)
# semanage fcontext -a -t samba_share_t "/shares(/.*)?"
# setsebool -P samba_export_all_rw on
5) accessing the shares
Start up the samba service (we set it up to start after a system reboot in step 1, but it's not actually running yet right now).
# service smb start
point your windows explorer to \\ipaddressofyourlinuxserver
You should see a folder for every share definition you made, in my example, a folder called Public and one called upload, even though in reality upload is inside Public.
I think I have provided you with a complete but minimal list of things to do to get samba working, I hope it helps.
Good luck!