Configure an SMB server accessible without a user or password in RedHat / CentOS

Here is a quick way to configure an Samba server accessible by everyone without a username or password.  The below has been tested in CentOS 6.5.

Install the Samba service and create a directory
yum -y install samba
mkdir /mysamba
chmod 777 /mysamba
chcon -R -t samba_share_t /mysamba

Configure Samba
vi /etc/samba/smb.conf
security = share   #Under “Standalone Server Options” change = user to = share
[mysamba]   #Add This section to the bottom of the smb.conf file
writable = yes
path = /mysamba
public = yes
guest ok = yes
guest only = yes
guest account = nobody
browsable = yes

Enable firewall to allow SMB ports

sudo iptables -I INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
sudo iptables -I INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
sudo iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
sudo service iptables save

Restart the smb service to reload the smb.conf file
service smb restart

Test the share to see if it works
mount -t cifs // /samba -o username=natasha
umount -l // #Does a lazy unmount of the above mount

This entry was posted in Linux, Storage and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *