转载自:https://www.howtoforge.com/samba-server-installation-and-configuration-on-centos-7
First I will explain the methodology to install the samba with the anonymous sharing. To install samba run,
yum install samba samba-client samba-common
Now to configure samba edit the file
/etc/samba/smb.conf before making changes I will make the backup of original file as
/etc/samba/smb.conf.bak
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
Further give the entries like this
vi /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================
[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
mkdir -p /samba/anonymous
systemctl enable smb.service
systemctl enable nmb.service
systemctl restart smb.service
systemctl restart nmb.service
Further CentOS 7.0 Firewall-cmd will block the samba access, to get rid of that we will run:
firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload
Now you can access the Centos 7.0 sharing in windows as follows, go to the Run prompt
From a windows machine just browse the folder and try to create a text file, but you will get an error of permission denied.
Check the permission for the shared folder.
To allow anonymous user give the permissions as follows:
cd /samba
chmod -R 0755 anonymous/
chown -R nobody:nobody anonymous/
Further, we need to allow the SELinux for the samba configuration as follows:
chcon -t samba_share_t anonymous/
Now anonymous user can browse & create the folder contents.