環境:

samba:smbserver: 192.168.0.18

AD:rise.com:192.168.0.37

組:zixun ?xingzheng ?teacher ?class ?admin

共享目錄:zixun ?xingzheng ?xueshu ?other


一.安裝Samba服務器


yum install -y samba


二.把linux加入到ad中


1.先復制/etc/krb5.conf配置文件為

cp /etc/krb5.conf /etc/krb5.conf1


打開/etc/krb5.conf配置文件

vim /etc/krb5.conf 修改參數


[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log

[libdefaults]
default_realm = ERIC.LOCAL(驗證域的realm,必須全部大寫)------RISE.COM
dns_lookup_realm = false
dns_lookup_kdb = false

[realms]

ERIC.LOCAL = { ? ? ? ? ? ? ? ---------RISE.COM

kdc = 192.168.1.1:88 ? ? ? ? ---------192.168.0.37:88

?default_domain = ERIC.LOCAL(缺省域名,同樣必須全部大寫)---------RISE.COM

}

[domain_realm]??
.eric.local= ERIC.LOCAL --------------RISE.COM

eric.local?= ERIC.LOCAL---------------RISE.COM


2.安裝kdc server


在 KDC (這里是 cdh1 ) 上安裝包 krb5、krb5-server 和 krb5-client

yum?install?krb5-server?krb5-libs?krb5-auth-dialog?krb5-workstation? -y


測試是否成功

#kinit lizheng@RISE.COM? lizheng 域管理用戶


如果輸入密碼返回shell表示成功



如果提示“kinit(v5):?Clock?skew?too?greate?while?getting?initial?credentials”的錯誤信息,說明是本機和域控的時間有誤差,解決辦法是#ntpdate??192.168.0.37 //域控ip?

成功的話會,會直接返回命令行。如圖所示?


yum install -y ntpdate


ntpdate??192.168.0.37


3.修改samba的配置文件


先復制/etc/samba/smb.conf 文件

cp /etc/samba/smb.conf /etc/samba/smb.conf1

修改vi?/etc/samba/smb.conf配置


#=======================?Global?Settings?=====================================

[global] 參數,修改以下參數

。。。。。。?


???? workgroup = RISE

? ? ? ? server string = Samba Server Version %v

? ? ? ? netbios name = risesmbserver

? ? ? ? realm = RISE.COM

? ? ? ? idmap uid = 10000 - 20000

? ? ? ? idmap gid = 10000 - 20000

? ? ? ? template shell = /sbin/nologin

? ? ? ? template homedir = /home/%D/%U

? ? ? ? winbind use default domain = true

? ? ? ? security=ads

? ? ? ? winbind separator = %

? ? ? ? winbind use default domain = yes

? ? ? ? winbind enum users = yes

? ? ? ? winbind enum groups = yes

? ? ? ? encrypt passwords = yes

? ? ? ? printing = bsd ? ?Windows打開samba服務器中的視頻卡解決辦法




standalone server options參數

?

security?=?domain?

?encrypt?passwords?=?yes??#這句話必須加,否則驗證不成功。

?passdb backend=tdbsam




doamin members options參數


security?=?domain

password?server?=?192.168.0.37 #域控ip

passdb backend=tdbsam

realm =RISE.COM




創建共享目錄


#mkdir /home/zixun? ? ------創建咨詢共享

#chmod -R 777 /home/zixun


#mkdir /home/xingzheng ------創建行政共享

#chmod -R 777 /home/xingzheng


#mkdir /home/xueshu ------創建學術共享

#chmod -R 777 /home/xueshu




[home]

???????? path = /home/%D/%U

???????? browsable = no

???????? writable = yes

???????? create mask = 0664

?? directory mask = 0775


[zixun]

? ? ? comment=domain

???? ; read only=yes

? ? ? path=/home/zixun

? ? ? browseable=yes

???? writable=no

? ? ? write list=+lizheng,+zixun

? ? ? create mask=0666

? ? ? directory mask=0777


[xueshu]

? ? ? comment=domain

? ? ?; read only=yes

? ? ? path=/home/xueshu

???? browseable=yes

? ? ? writable=no

? ? ? write list=+lizheng,+teacher,+class

? ? ? create mask=0666

? ? ? directory mask=0777


[soft]

? ? ? comment=domain

? ? ? ;read only=yes

? ? ? path=/home/soft

? ? ? writable=no

? ? ? browseable=yes

? ? ? public=yes

? ? ? create mask=0666

? ? ? directory mask=0777

? ? ? write list=+xingzheng,+zixun,+teacher,+class,+lizheng





4.添加winbind寫入帳號的信任

先復制 /etc/nsswitch.conf文件

cp /etc/nsswitch.conf /etc/nsswitch.conf1

打開?vim?/etc/nsswitch.conf配置

修改

passwd:??? files???winbind

shadow:??? files???winbind

group:?????? files???winbind

netgroup:???nisplus?winbind



啟動samba服務


#service smb start


啟動winbind服務


service winbind start


測試域


kinit?lizheng@RISE.COM


加入域

net rpc join ?RISE.COM -U lizheng@RISE.COM


#wbinfo -t?????? #看winbind是否正常運行

?

#wbinfo -u????? #看AD用戶是否同步過來了


smb nmb加入啟動服務?
chkconfig --level 35 smb on ? ? ? ? ??

chkconfig --level 35 nmb on?

chkconfig --level 35 winbind on




訪問Samba共享的文件很慢很慢的解決方法


  1. 修改/etc/sysconfig/network 文件把hostname修改成smb服務器的名字

?? 2.修改/etc/hosts? 添加一行127.0.0.1 smb服務器的名字