共计 1216 个字符,预计需要花费 4 分钟才能阅读完成。
	一、安装 samba 软件 
1、使用 yum -y install samba samba-client samba-common 安装 Samba
2、查看 Samba 版本信息 rpm -qi samba
	二、修改配置文件 
1、备份原有的配置文件
# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
2、在配置文件末尾开始配置,添加如下内容
# vi /etc/samba/smb.conf
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
# log files split per-machine:
log file = /var/log/samba/log.%m
netbios name = CentOS 7
# maximum size of 50KB per log file, then rotate:
max log size = 50
security = user
#security = share
#map to guest = Bad User
#passdb backend = tdbsam
[public]
path = /home/guozi/mount
public = no
browsable =yes
writable = yes
write list = @guozi
#guest ok = yes
read only = no
三、添加用户
useradd guozi
smbpasswd -a guozi
mkdir -p /home/guozi/mount
chow guozi.guozi -R /home/guozi/mount
四、启动服务
systemctl restart smb.service
systemctl enable smb.service
五、测试
smbclient -L localhost -U guozi
如果出现以下情况,则说明是可以的:
	Enter guozi's password:
	Domain=[MYGROUP] OS=[Windows 6.1] Server=[Samba 4.2.3]
	    Sharename       Type      Comment
	    ———       —-      ——-
	    Anonymous       Disk      
	    IPC$            IPC       IPC Service (Samba Server Version 4.2.3)
	Domain=[MYGROUP] OS=[Windows 6.1] Server=[Samba 4.2.3]
	    Server               Comment
	    ———            ——-
	六、windows中连接 
输入 \\ip\public 访问, 效果如下图:
                            
alert(“hello”);