ad域搭建共享文件伺服器
㈠ samba如何加入ad域搭建文件共享
1、安裝所需軟體:
# yum -y install samba samba-client samba-common samba-winbind samba-winbind-clients krb5-workstation ntpdate
2、設置服務自啟動並啟動服務:
# chkconfig smb on
# chkconfig winbind on
# service smb start
# service winbind start
3、修改 /etc/hosts 文件,添加主機對應記錄:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain
192.168.2.150 lemon20.contoso.com
4、設置 DNS 地址並與 AD 伺服器同步時間:
# echo "192.168.44.108" >> /etc/resolv.conf
# ntpdate ad.contoso.com
5、設置 Kerberos 票據(可選):
銷毀已經存在的所有票據:
# kdestroy
查看當前是否還存在票據:
# klist klist: No credentials cache found (ticket cache FILE:/tmp/krb5cc_0)
生成新的票據,注意域名大寫。
#kinit [email protected] #檢查krb5能否正確請求kerbroes票據
6、以命令方式設置 samba 與 Kerberos,並加入 AD 域:
#authconfig --enablewinbind --enablewins --enablewinbindauth --smbsecurity domain --smbworkgroup=CONTOSO --smbrealm CONTOSO.COM --smbservers=ad.contoso.com --enablekrb5 --krb5realm=CONTOSO.COM --krb5kdc=ad.contoso.com --krb5adminserver=ad.contoso.com --enablekrb5kdcdns --enablekrb5realmdns --enablewinbindoffline --winbindtemplateshell=/bin/bash --winbindjoin=administrator --update --enablelocauthorize --enablemkhomedir --enablewinbinsedefaultdomain
注意命令中的大小寫,此步驟也可以使用 authconfig-tui 完成,加入後會提示No DNS domain configured for pmsamba. Unable to perform DNS Update.
DNS update failed: NT_STATUS_INVALID_PARAMETER ,此警告可以忽略!
7、增加 sudo 許可權(可選):
# visudo
加入下列設置:
%MYDOMAIN//domain/ admins ALL=(ALL) NOPASSWD: ALL
8、確認是否正確加入 AD 域:
查看 AD 的相關信息
# net ads info
# wbinfo -u
#wbinfo -t
#wbinfo -g
#getent passwd
#getent group
#testparm #測試smb.conf是否正確
問題排錯:
Cannot find KDC for requested realm while getting initial credentials dns未正確指向
KDC reply did not match expectations while getting initial credentials 域名不對或者時間不同步
一般檢測會提示:
WARNING: The setting 'security=ads' should NOT be combined with the 'password server' parameter.
(by default Samba will discover the correct DC to contact automatically).
系統認為己設置了「security = ADS」就不必設置「password server =」因為samba會自己認到,可以忽略此警告!
㈡ 在AD域中建立了一個文件伺服器,在伺服器中建立一文件共享
讓demo是擁有者就可以了