在 redhat 9 用 rpm包 安裝
因為 Samba3 預設就有 Ldap 支援,Samba 2 要先編譯再安裝比較麻煩,乾脆重新安裝 Samba3
samba 3.x 安裝之前先移除 samba 2.x 的版本
#rpm -e samba-swat
#rpm -e samba-client
#rpm -e redhat-config-samba
#rpm -e samba
#rpm -e samba-common
#rpm -ivh samba-3.0.2a-1_rh9.i386.rpm (只有一包)
修改 smb.conf
; wins support = yes (作為 wins service 的 slave 接受 163.32.225.4 的管控)
wins server 163.32.225.4 (向本校的 wins server 去報到)
logon script = %U.bat :個人設定檔
logon path = %L%U.profiles :個人設定檔位置
logon home = %L%U.profiles
[homes]
comment = Home Directories
browseable = no
writable = yes :家目錄權限
valid users = %S
create mode = 0664
directory mode = 0775
[netlogon] :登入指令稿
comment = Network Logon Service
path = /home/netlogon :登入指令稿位置
guest ok = yes :登入指令稿權限
writable = no
share modes = no
/home/netlogon/jnur.bat :登入指令稿
net use h: /hoem(ctrl+v)(ctrl+m) :斷行
從redhat 9 disk1、disk2分別取得4個套件包
rpm -ivh openldap-2.0.27-8.i386.rpm
rpm -ivh openldap-servers-2.0.27-8.i386.rpm
rpm -ivh openldap-clients-2.0.27-8.i386.rpm
rpm -ivh openldap-devel-2.0.27-8.i386.rpm
修改/etc/openldap/slapd.conf
database ldbm
suffix "dc=ldap,dc=hmes,dc=kh,dc=edu,dc=tw"
rootdn "cn=Manager,dc=ldap,dc=hmes,dc=kh,dc=edu,dc=tw"
rootpw {SSHA}83DJ4KVwqlk1uh9k2uDb8+NT1U4RgkEs
directory /var/lib/ldap/【須把ldap資料夾的權限開到777讓ldapsearch -x才讀得到】
管理者密碼的製造過程
#slappasswd
New password
Re-enter new password
{SSHA}83DJ4KVwqlk1uh9k2uDb8+NT1U4RgkEs
啟動 service ldap start
自行編輯一個 .ldif 檔
新增第一筆 basedn.ldif (Base Distinguish Name)資料至 openldap
#vi basedn.ldif
#建立根節點
dn:dc=ldap,dc=hmes.kh.edu.tw
dc:ldap
objectclass:dcobject
objectClass: top
objectclass:organizationalUnit
ou:ldaper
#建group ou
dn: ou=group,dc=ldap,dc=hmes.kh.edu.tw
objectClass: top
objectClass: organizationalUnit
ou: group
description: system groups
#建teacher ou
dn: ou=teacher,dc=ldap,dc=hmes.kh.edu.tw
objectClass: top
objectClass: organizationalUnit
ou: teacher
description: teachers account
#建student ou
dn: ou=student,dc=ldap,dc=hmes.kh.edu.tw
objectClass: top
objectClass: organizationalUnit
ou: student
description: students account
#建machine ou
dn: ou=machine,dc=ldap,dc=hmes.kh.edu.tw
objectClass: top
objectClass: organizationalUnit
ou: machine
description: machines account
#建admin ou
dn: ou=admin,dc=ldap,dc=hmes.kh.edu.tw
objectClass: top
objectClass: organizationalUnit
ou: admin
description: Administrators account
加入最初名錄項目:在ldap停機狀態下(否則仍會搜索到資料,但是.tdb已經不見了)
# slapadd -v -l /home/user/wplee/basedn.ldif
測試:#ldapsearch -x -b "dc=ldap,dc=hmes,dc=kh,dc=edu,dc=tw""(objectclass=*)"
結果
# filter: (objectClass=*)
# requesting: ALL
#
# ldap, hmes, kh, edu, tw
dn: dc=ldap,dc=hmes,dc=kh,dc=edu,dc=tw
objectClass: top
# search result
search: 2
result: 0 Success【0:指的是搜索成