Windows平台通常不太稳定,易于受病毒的攻击。利用samba,结合NTLM,在BSD平台下通过Kerberos验证来打造linux/unix平台下的文件服务器,从而远离病毒的骚扰。
一. 配置Kerberos验证
Kerberos验证需要安装Krb5软件包。配置文件及测试都很简单。Krb5的配置文件名为krb5.conf
# find / -name "krb5.conf"
/usr/src/crypto/heimdal/krb5.conf
找到文件后,将其复制一份到其他目录
# cp /usr/src/crypto/heimdal/krb5.conf /etc
配置krb5.conf
<a target="_blank" href="http://blog.51cto.com/attachment/201104/232440767.png"></a>
配置完成后通过kinit命令测试
<a target="_blank" href="http://blog.51cto.com/attachment/201104/232533271.png"></a>
<a target="_blank" href="http://blog.51cto.com/attachment/201104/232533271.png">出现上面的提示,即表示成功完成Kerberos配置</a>
二. 安装samba套件
安装samba套件时,记得编译下面两项内容
<a target="_blank" href="http://blog.51cto.com/attachment/201104/232720440.png"></a>
<a target="_blank" href="http://blog.51cto.com/attachment/201104/232649912.png"></a>
三. 配置samba
你所在域的Netbios 名
workgroup = xxx
选择ADS
security = ADS
验证服务器所在地址
password server = 192.168.0.20
该处填写所在域的域名,记住要大写
realm = xxxx
在配置文件[global]段加入以下语句
<a target="_blank" href="http://blog.51cto.com/attachment/201104/233048720.png"></a>
用户主目录设置
<a target="_blank" href="http://blog.51cto.com/attachment/201104/233129520.png"></a>
配置共享示例
<a target="_blank" href="http://blog.51cto.com/attachment/201104/233225912.png"></a>
<a target="_blank" href="http://blog.51cto.com/attachment/201104/233246108.png"></a>
加入samba启动项
samba_enable="YES"
winbindd_enable="YES"
四. 正式将本台freebsd samba server加入windows 2003域中
<a target="_blank" href="http://blog.51cto.com/attachment/201104/233425700.png"></a>
<a target="_blank" href="http://blog.51cto.com/attachment/201104/233532998.png"></a>
加入域后,看一下windows 2003的域控中有无此server的记录
完成后,不要忘了重启samba服务
# /usr/local/etc/rc.d/samba restart
# wbinfo -u
# wbinfo -g
# wbinfo -t
仅仅这两项显示正确还是不够的,还要看getent 命令查看。用此命令查看前,需要配置nsswitch.conf文件,该文件控制帐号的验证
<a target="_blank" href="http://blog.51cto.com/attachment/201104/234006502.png"></a>
# getent passwd
# getent group
六. 测试ntlm_auth验证
<a target="_blank" href="http://blog.51cto.com/attachment/201104/234213956.png"></a>
说明:最后要说明的是,要用户主目录这个主目录的路径需要自己手动创建。
还有,该配置也可结合samba-vscan来实现实时扫描病毒功能,本部分省略
七.补充
<a target="_blank" href="http://blog.51cto.com/attachment/201104/235233121.png"></a>
上述脚本利用了位置参数 $1,$2
samba主配置文件[home]中增加如下部分
root preexec = /usr/local/sbin/mkhome.sh %D %U
本文转自dongfang_09859 51CTO博客,原文链接:http://blog.51cto.com/hellosa/537764,如需转载请自行联系原作者