经常会有这样的需求,应用和数据库服务器都发布在linux上,开发人员经常会去取相关日志做诊断,如果linux上能共享文件夹给window就好了,此时samba就派上了用场。
在samba的官方网站https://www.samba.org/下载最新的源代码。
1. 安装samba[root@VM-10 samba-4.2.4]#cd /data/gg/samba-4.2.4
[root@localhost samba]# ./configure
[root@localhost samba]# make
[root@localhost samba]# make install
2.配置并检查/etc/samba/smb.conf
改三个地方:
修改security = user
加上map to guest = Bad User (samba 4以上是配置这两个产生,配置security = share无效)
加上[share]
comment = share all
path = /data/gg
guest ok = Yes
检查配置文件
[root@VM-10 samba]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[share]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
server string = Samba Server Version %v
map to guest = Bad User
log file = /var/log/samba/log.%m
max log size = 50
idmap config * : backend = tdb
cups options = raw
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
print ok = Yes
browseable = No
[share]
comment = share all
path = /data/gg
guest ok = Yes
3.将/etc/samba/smb.conf 拷贝/usr/local/samba/etc/smb.conf,程序默认读后者
4.启动服务
[root@VM-10 sbin]# /usr/local/samba/sbin/smbd -D
[root@VM-10 sbin]# /usr/local/samba/sbin/nmbd -D
5. 在windows运行中运行\\10.10.15.208即可看到linux下的共享
遇到的错误:
[root@localhost samba]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
[root@VM-10 ~]# more /etc/security/limits.conf
root - nofile 16384
[root@VM-10 ~]# reboot
程序无法启动,看系统日志tail -f /var/log/messages