Samba by nature has guest access for various purposes. However, you can disable guest access to prevent anonymous browsing and tighten security overall.
1. Edit the smb.conf file:
$ sudo nano /etc/samba/smb.conf
Add this line to the [global] section:
restrict anonymous = 2
2. Close and save the file. Then restart samba.
This will restart samba on Ubuntu:
sudo service smbd restart
or on Centos:
# /etc/init.d/smb restart