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是拥有者就可以了