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,如需轉載請自行聯系原作者