- 論壇徽章:
- 0
|
Samba+LDAP+LAM管理工具應(yīng)用
可以在作者的BLOG上找到這篇文章的PDF文件,下載后方便閱讀
作者:gavin
電子郵箱:gavin.zhou@gmail.com msn:gavin_zhm@msn.com
主頁(yè)地址:blog.yepn.net
建立日期:2008年04月11日,最后修改日期:2008年04月11日
版本: 0.1
版權(quán)說(shuō)明:本文基于創(chuàng)作共用約定,內(nèi)容歸作者版權(quán)所有,歡迎大家轉(zhuǎn)載,但要請(qǐng)保留作者的完整信息和出處,謝謝!
本文參考:RedHat Enterprise Linux Server 4.3 + OpenLDAP + DNS + Samba + Postfix + OpenWebmail 作者 Fandy
http://72891.cn/thread-805302-1-1.html
使用 OpenLDAP 集中管理用戶(hù)帳號(hào) 作者 Mike O'Reilly IBM
http://www.ibm.com/developerworks/cn/linux/l-openldap/#author
OpenLDAP 2.1 管理員指南 翻譯 NTKO
http://i18n.linux.net.cn/others/OpenLDAP2.htm#_Toc14210017
作者 注:
由于公司使用的文件服務(wù)器空間不足(只有750G),所以準(zhǔn)備新裝一臺(tái)服務(wù)器。另外,小弟現(xiàn)在管理公司網(wǎng)絡(luò),每新來(lái)一名員工就要建6-7個(gè)ID,網(wǎng)絡(luò)認(rèn)證ID,Samba ID,郵件ID,SNS ID,Desknet ID等等,讓日常維護(hù)工作量大大增加,所以打算在公司應(yīng)用LDAP服務(wù)器,也可以借這次新的Samba服務(wù)器,先把SambaID導(dǎo)出到LDAP中。
小弟在服務(wù)器構(gòu)筑過(guò)程中也有很多很多的問(wèn)題多用GOOGLE是最好的方法,如果能找到高人請(qǐng)教也是一種方法,不過(guò)總有效的還是GOOGLE一下,這樣對(duì)自己也是一種學(xué)習(xí)過(guò)程。另外,對(duì)于一些LINUX前輩寫(xiě)的文章要仔細(xì)閱讀特別是安裝文件的版本號(hào),往往很小的細(xì)節(jié)會(huì)讓你浪費(fèi)一天的時(shí)間。
文章分為
I.OS準(zhǔn)備確認(rèn)
II.OpenLDAP和SAMBA安裝設(shè)置
III.Samba用戶(hù)和組導(dǎo)入(smbldap-tool使用例)
IV.LAM軟件安裝和應(yīng)用
服務(wù)器環(huán)境
1.CentOS 5.0 Linux server 2.6.18-53.1.14.el5
安裝后先配置一下yum再升級(jí)一下,Centos帶的yum站點(diǎn)好像沒(méi)有REDHAT家的好用,有可能是個(gè)人感覺(jué),不過(guò)我還是按照Centos網(wǎng)站上寫(xiě)的添加了一下裝了一下RPMforge
#yum install yum-priorities
#vi /etc/yum/pluginconf.d/priorities.conf
[main]
enabled=1
#vi /etc/yum.repos.d/
priority=N #我設(shè)置的N=1
#wget http://apt.sw.be/redhat/el5/en/i ... 6-1.el5.rf.i386.rpm
#rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#yum check-update #升級(jí)一下
2.Apache 2.2.6 Released (現(xiàn)在2.2.8已經(jīng)Released了)
源碼包安裝
./configure && make && make install
安裝后Document Root為
/usr/local/apache2/htdocs
3.PHP Version 5.2.5
源碼包安裝
./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --with-zlib --with-gd --with-jpeg-dir --with-png-dir --with-mysql --with-mcrypt --with-xsl --with-gettext --with-ldap --with-mhash --with-imap --with-imap-ssl && make && make install
對(duì)于參數(shù)有不明白的朋友可以GOOGLE一下,講的會(huì)比我寫(xiě)的明白。
PHP安裝后要設(shè)置Apache的配置文件httpd.conf,內(nèi)容請(qǐng)參考PHP源碼包中的INSTALL文件,我就是按上面寫(xiě)的。
4.OpenLDAP和Samba安裝都用的yum安裝,如果想用源碼包安裝的話(huà),需要自己安裝一些LIB等文件,詳細(xì)說(shuō)明請(qǐng)參考我的WIKI網(wǎng)站http://wiki.yepn.net中OpenLDAP中有詳細(xì)的源包碼說(shuō)明。上面提到的Apache和PHP源碼包安裝也有詳細(xì)的說(shuō)明。
5.對(duì)于Samba和LDAP用戶(hù)管理需要smbldap-tool這個(gè)工具用起來(lái)很方便。一樣用yum安裝
#yum -y install smbldap-tool
============================華麗的分劃線(xiàn)============================
OpenLDAP配置文件說(shuō)明
vi /etc/openldap/sladp.conf
特別注意:下面的配置文件使用時(shí)請(qǐng)去掉注釋?zhuān)琇DAP對(duì)配置文件格式有嚴(yán)格要求。
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
include /etc/openldap/schema/samba.schema
#這個(gè)samba.schema文件,如果用yum安裝后可以在
/usr/share/doc/samba-3.0.25b/LDAP/下找到復(fù)制到上面指定的目錄
include /etc/openldap/schema/corba.schema
include /etc/openldap/schema/misc.schema
# Allow LDAPv2 client connections. This is NOT the default.
allow bind_v2
#允許使用bind v2 有些設(shè)備需要用到Samba用V3
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
#loglevel 296
#調(diào)試的時(shí)候加的LOG配置文件,運(yùn)行正常后去掉了,不想生成大量的LOG文件
access to attrs=userPassword
by self write
by anonymous auth
by dn="uid=admin,ou=Users,dc=yepn,dc=com" write
by * none
access to *
by self write
by dn="uid=admin,ou=Users,dc=yepn,dc=com" write
by * read
#上面是配置訪(fǎng)問(wèn)權(quán)限
對(duì)于userPassword字段自己可以改寫(xiě),用戶(hù)admin可以改寫(xiě),匿名用戶(hù)可以認(rèn)證,其他拒絕。
自己可以寫(xiě)自己dc中的所有權(quán)限,admin用戶(hù)可以寫(xiě)全部,所有人可讀。
上面ACL的順序也很重要,調(diào)換的話(huà)會(huì)出現(xiàn)PAM認(rèn)證問(wèn)題。
database bdb
suffix dc=yepn,dc=yepn
rootdn cn=root,dc=yepn,dc=com
directory /var/lib/ldap
index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub
index sambaSID,sambaSIDList,sambaGroupType eq,pres
# Replicas of this database
replogfile /var/lib/ldap/openldap-master-replog
#replica host=172.30.4.91:389 starttls=critical
replica host=172.30.4.91:389
binddn="cn=root,dc=yepn,dc=com"
credentials=111111
bindmethod=simple
#上段為從LDAP服務(wù)器,只有一臺(tái)LDAP服務(wù)器的網(wǎng)絡(luò)配置不太穩(wěn)定,萬(wàn)一LDAP服務(wù)器壞掉,會(huì)出現(xiàn)很多系統(tǒng)不能登陸的問(wèn)題。
rootpw 000000 #密碼名文,過(guò)后會(huì)把ROOT從配置文件中刪除,用admin用戶(hù)管理LDAP
配置文件確認(rèn)無(wú)誤后啟動(dòng)LDAP
#service ldap start
看到下面的信息說(shuō)明你的LDAP正常啟動(dòng)了
Checking configuration files for slapd: config file testing succeeded
Starting slapd: [ OK ]
Starting slurpd: [ OK ]
============================華麗的分劃線(xiàn)============================
Samba安裝可以參考Fandy的RedHat Enterprise Linux Server 4.3 + OpenLDAP + DNS + Samba + Postfix + OpenWebmail 這篇文章我的Samba配置配置是按照他上面寫(xiě)的配置的。
下面是我的配置文件,簡(jiǎn)單說(shuō)明一下,因?yàn)樵牡淖髡邔?xiě)的很細(xì)。
# Global parameters
# Version 2008-03-28-01
[global]
workgroup = YEPN
netbios name = vanilla
security = user
server string = Samba Server 7T %v
encrypt passwords = Yes
obey pam restrictions = No
ldap passwd sync = yes
#與LDAP密碼同步
log level = 3
syslog = 0
log file = /var/log/samba/log.%m
max log size = 100000
time server = Yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
mangling method = hash2
Dos charset = UTF-8
Unix charset = UTF-8
logon script = %U.bat
logon drive = H:
domain logons = Yes
os level = 65
preferred master = Yes
passdb backend = ldapsam:ldap://127.0.0.1/
#指定LDAP服務(wù)器
ldap admin dn = uid=root,dc=yepn,dc=net
#可以管理員用戶(hù)
ldap suffix = dc=yepn,dc=net
#搜索域
ldap group suffix = ou=Groups
#用戶(hù)級(jí)的檢索字段
ldap user suffix = ou=Users
#用戶(hù)檢索字段
add user script = /usr/sbin/smbldap-useradd -a -m "%u"
#添加用戶(hù)
ldap ssl = off
ldap delete dn = Yes
delete user script = /usr/sbin/smbldap-userdel -r "%u"
#刪除用戶(hù)
add group script = /usr/sbin/smbldap-groupadd -a -p "%g"
#添加組
delete group script = /usr/sbin/smbldap-groupdel "%g"
#刪除組
add user to group script = /usr/sbin/smbldap-groupmod -m "%u" "%g"
#把用戶(hù)加到指定組
delete user from group script = /usr/sbin/smbldap-groupmod -x "%u" "%g"
#從組中刪除用戶(hù)
set primary group script = /usr/sbin/smbldap-usermod -g '%g' '%u'
#設(shè)定用戶(hù)的屬組
#以上配置是跟LDAP相關(guān)的,其他對(duì)于共享目錄等控制可以自行添加
[homes]
comment = Home Directories %U, %u
browseable = no
writeable = yes
read only = no
force create mode = 0700
force directory mode = 0700
directory mode = 0700
create mode = 0700
inherit acls = yes
guest ok = no
printable = no
#homes目錄的定義,其實(shí)這個(gè)作用已經(jīng)不大了,因?yàn)榻⒛夸浀臅r(shí)候會(huì)通過(guò)smbldap-tool
Samba配置完后啟動(dòng)一下
#service smb start
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
顯示上面的說(shuō)明正常啟動(dòng),第二個(gè)服務(wù)說(shuō)明一下是NETBIOS服務(wù)
#smbpasswd -w 111111
#把LDAP的管理員密碼加到Samba中,這個(gè)一定要做,讓Samba對(duì)LDAP有權(quán)修改。
============================華麗的分劃線(xiàn)============================
寫(xiě)在Samba安裝之前
Samba服務(wù)器安裝之前,需要修改服務(wù)器的PAM認(rèn)證,讓系統(tǒng)用戶(hù)通過(guò)LDAP認(rèn)證,具體內(nèi)容可以參考《使用 OpenLDAP 集中管理用戶(hù)帳號(hào)》這篇文章寫(xiě)的很細(xì)。如果你的系統(tǒng)可以通過(guò)LDAP認(rèn)證登陸了,請(qǐng)繼續(xù)向下看,如果不行,不要向下進(jìn)行。
Samba用戶(hù)和組導(dǎo)入
原來(lái)的Samba用戶(hù)和組采用系統(tǒng)帳號(hào),現(xiàn)在導(dǎo)入起來(lái)也比較方便。
很多文章介紹用MigrationTools這個(gè)工具導(dǎo)入,我用的是smbldap-tools這個(gè)工具導(dǎo)入的用戶(hù)和組。
在用smbldap-tool之前先要配置一下,下面是我的配置文件,會(huì)說(shuō)明一下。
用yum安裝后配置文件在下面的目錄可以找到
# ls /etc/smbldap-tools/
smbldap_bind.conf smbldap.conf
#vi smbldap_bind.conf
slaveDN="cn=root,dc=yepn,dc=com"
slavePw="111111"
masterDN="cn=root,dc=yepn,dc=com"
masterPw="111111"
#這部分要與前面你配置的LDAP服務(wù)器的管理員相同
然后是smbldap.conf配置文件,這個(gè)文件在建立用戶(hù)時(shí)比較重要
SID="S-1-5-21-1153389650-4125104348-4025214935"
#SID每臺(tái)服務(wù)器特有的ID號(hào)用下面命令生成,這個(gè)一定要修改,不然Samba通過(guò)LDAP建立的用戶(hù)會(huì)有問(wèn)題,我開(kāi)始就因?yàn)檫@個(gè)地方困惑了好久。
#net getlocalsid
sambaDomain="YEPN"
#改成自己的Samba域
slaveLDAP="127.0.0.1"
slavePort="389"
masterLDAP="127.0.0.1"
masterPort="389"
#LDAP服務(wù)器設(shè)置
ldapTLS="0"
#LDAP認(rèn)證時(shí)候加密碼,因?yàn)樵诠緝?nèi)部網(wǎng)絡(luò)使用,我又不想弄SSL所以沒(méi)加密,如果有需要的朋友可以參考《使用 OpenLDAP 集中管理用戶(hù)帳號(hào)》這篇文章做一下TLS,這個(gè)地方的參數(shù)改成1
verify="require"
cafile="/etc/smbldap-tools/ca.pem"
clientcert="/etc/smbldap-tools/smbldap-tools.pem"
clientkey="/etc/smbldap-tools/smbldap-tools.key"
#以上為安裝后默認(rèn)設(shè)置沒(méi)改動(dòng)過(guò)
suffix="dc=yepn,dc=com"
#前面配置LDAP時(shí)說(shuō)過(guò),不再解釋了
usersdn="ou=Users,${suffix}"
#用戶(hù)的檢索字段
#computersdn="ou=Computers,${suffix}"
#我不用Samba做PDC,所以去掉了這項(xiàng)
groupsdn="ou=Groups,${suffix}"
#用戶(hù)組的檢索字段
hash_encrypt="SSHA"
#Password的加密方式
#以下為建立UNIX用戶(hù)時(shí)的參數(shù)
userLoginShell="/bin/false"
#我不需要用戶(hù)登陸服務(wù)器
userHome="/home/%U"
#用戶(hù)的home目錄,Samba的homes用這個(gè)
# Default mode used for user homeDirectory
userHomeDirectoryMode="700"
#HOME目錄的權(quán)限
# Gecos
userGecos="System User"
# Default User (POSIX and Samba) GID
defaultUserGid="513"
#用戶(hù)屬組ID是SAMBA用戶(hù)
defaultMaxPasswordAge="45"
#默認(rèn)值
#下面是Samba用戶(hù)配置參數(shù)
userSmbHome="\\PDC-SRV\%U"
#homes目錄
userProfile="\\PDC-SRV\profiles\%U"
userHomeDrive="H:"
userScript="logon.bat"
mailDomain="yepn.net"
with_smbpasswd="0"
smbpasswd="/usr/bin/smbpasswd"
with_slappasswd="0"
slappasswd="/usr/sbin/slappasswd"
#以上除郵件域名外沒(méi)有修改
smbldap-tool配置完成,fandy介紹了一種用smbldap-tools自帶的configure.pl腳本創(chuàng)建smbldap.conf配置文件,我沒(méi)用這個(gè),感覺(jué)還是自己改的比較快。
============================華麗的分劃線(xiàn)============================
現(xiàn)在用smbldap-tool初始化LDAP,很簡(jiǎn)單運(yùn)行一下面的命令
#smbldap-populate
Populating LDAP directory for domain yepn (你自己服務(wù)器的SID號(hào),這個(gè)一定要修改)
(using builtin directory structure)
adding new entry: dc=yepn,dc=net
adding new entry: ou=Users,dc=yepn,dc=net
adding new entry: ou=Groups,dc=yepn,dc=net
adding new entry: ou=Computers,dc=yepn,dc=net
adding new entry: ou=Idmap,dc=yepn,dc=net
adding new entry: uid=root,ou=Users,dc=yepn,dc=net
adding new entry: uid=nobody,ou=Users,dc=yepn,dc=net
adding new entry: cn=Domain Admins,ou=Groups,dc=yepn,dc=net
adding new entry: cn=Domain Users,ou=Groups,dc=yepn,dc=net
adding new entry: cn=Domain Guests,ou=Groups,dc=yepn,dc=net
adding new entry: cn=Domain Computers,ou=Groups,dc=yepn,dc=net
adding new entry: cn=Administrators,ou=Groups,dc=yepn,dc=net
adding new entry: cn=Account Operators,ou=Groups,dc=yepn,dc=net
adding new entry: cn=Print Operators,ou=Groups,dc=yepn,dc=net
adding new entry: cn=Backup Operators,ou=Groups,dc=yepn,dc=net
adding new entry: cn=Replicators,ou=Groups,dc=yepn,dc=net
adding new entry: sambaDomainName=yepn,dc=yepn,dc=net
Please provide a password for the domain root:
Changing password for root
New password : 111111 (root的ldap管理密碼)
Retype new password : 111111 (root的ldap管理密碼)
介紹一下用smbldap-tool來(lái)管理帳號(hào)
詳細(xì)操作:
# smbldap-useradd -a -m test (添加一個(gè)samba帳號(hào)并創(chuàng)建主目錄)
# smbldap-groupadd -a -m yepn (添加一個(gè)samba組帳號(hào))
注:fandy的文章中沒(méi)有加-a這個(gè)參數(shù),這個(gè)參數(shù)smbldap-tool幫助中說(shuō)明-a這個(gè)參數(shù)為
add an automatic Security ID for the group (SID).
The rid of the group is calculated from the gidNumber of the
group as rid=2*gidNumber+1001. Thus the resulted SID of the
group is $SID-$rid where $SID and $rid are the domain SID and
the group rid
所以我感覺(jué)還是加上好,這個(gè)地方添加用戶(hù)組的時(shí)候一定加-a,這個(gè)不會(huì)在改變用戶(hù)屬組后看不到共享文件
# smbldap-groupmod -m test yepn (添加user2用戶(hù)帳號(hào)到acc帳號(hào)中)
adding user test to group yepn
更改test帳號(hào)的密碼:
詳細(xì)操作:
# smbldap-passwd test
# smbpasswd test
#以上兩個(gè)密令都可以個(gè)改Samba密碼,不同的是smbldap-passwd會(huì)連unix的密碼一起修改,為什么要用smbpass修改密碼,或許你需要unixpassword用做別的系統(tǒng)的密碼,比如郵件,證書(shū)認(rèn)證等。
Changing password for test
New password : test (用戶(hù)密碼)
Retype new password : test (確認(rèn)用戶(hù)密碼)
添加test帳號(hào)的信息:
#可以再修改帳號(hào)的信息,默認(rèn)是smbldap.conf中的配置
詳細(xì)操作:
# smbldap-userinfo test
查看test帳號(hào)的信息:
詳細(xì)操作:
# smbldap-usershow test
test帳號(hào)建立后可以測(cè)試一下,看看能不能看到共享文件
# smbclient -L localhost -U test
Password:
如果下面能正常顯示共享信息,說(shuō)明你的Samba服務(wù)器已經(jīng)通過(guò)LDAP認(rèn)證了。
下面會(huì)介紹管理LDAP和Samba的工具LAM
============================華麗的分劃線(xiàn)============================
把原來(lái)的Samba用戶(hù)和組信息導(dǎo)入到LDAP服務(wù)器
很多文章介紹MigrationTools這個(gè)工具導(dǎo)入,如果你也想用這個(gè)導(dǎo)入,可以GOOGLE一下,這里不做介紹。
因?yàn)镸igrationTools工具導(dǎo)入用戶(hù)時(shí)沒(méi)有Samba用戶(hù)的相關(guān)信息,所以我用的是smbldap-tools這個(gè)工具導(dǎo)入的用戶(hù)和組。
先拿到原來(lái)Samba服務(wù)器上的passwd和group文件
passwd文件刪除系統(tǒng)帳號(hào)只留下Samba帳號(hào)
#awk -F: '{print $1,$3,$4}' passwd > userlist
這樣導(dǎo)出來(lái)的數(shù)據(jù)結(jié)構(gòu)是:用戶(hù)名 UID GID
group文件刪除系統(tǒng)帳號(hào)只留下Samba組
#awk -F: '{print $1,$3,$4}' group > grouplist
這樣導(dǎo)出來(lái)的數(shù)據(jù)結(jié)構(gòu)是:組名 GID 用戶(hù)列表
有了這兩個(gè)文件后寫(xiě)一個(gè)很簡(jiǎn)單的腳本文件,通過(guò)smbldap-useradd添加用戶(hù)
#more useradd.sh
#!/bin/bash
while read name uid gid
do
/usr/sbin/smbldap-useradd -a -u $uid -g $gid -m $name
done < userlist
很簡(jiǎn)單,都能看明白不解釋了,對(duì)于smbldap-useradd不明白的朋友可以,man smbldap-useradd看一下各個(gè)參數(shù)。
建立組用戶(hù)也一樣
#more groupadd.sh
#!/bin/bash
while read name gid member
do
/usr/sbin/smbldap-groupadd -a -g $gid $name
done < grouplist
再來(lái)就是把用戶(hù)加到指定組中,只是把上面的文件小小修改一下就可以,通過(guò)smbldap-groupmod
#more groupmember.sh
#!/bin/bash
while read name gid member
do
/usr/sbin/smbldap-groupmod -m "$member" $name
done < grouplist
到上面為止用戶(hù)和組都已經(jīng)導(dǎo)入,而且設(shè)定好了用戶(hù)的屬組。不過(guò)Samba用戶(hù)的密碼還都沒(méi)有設(shè)置,這個(gè)還是需要設(shè)置一下的
在設(shè)置密碼時(shí),我沒(méi)找到什么好方法,所以用了expect這個(gè)命令,如果有更好的辦法,希望能補(bǔ)充一下。
CentOS默認(rèn)expect這個(gè)是沒(méi)安裝的,安裝很簡(jiǎn)單直接yum
#yum -y install expect
先寫(xiě)個(gè)改密碼的腳本
#more chpass.exp
#!/usr/bin/expect
spawn /usr/sbin/smbldap-passwd [lindex $argv 0]
set password [lindex $argv 1]
expect "*password:"
#sleep .1
send "$password\n"
expect "*password:"
send "$password\n"
expect eof
再用smbldap-passwd來(lái)改用戶(hù)密碼
#more userpasswd.sh
#!/bin/bash
while read name uid gid
do
/usr/bin/expect chpass.exp $name 123456
done < userlist
#這個(gè)需要等一段時(shí)間,我用戶(hù)不多只有100多個(gè),如果你用戶(hù)多的話(huà),可以時(shí)間更長(zhǎng)
到這里Samba用戶(hù)全都遷移到LDAP認(rèn)證了,以后建立用戶(hù)刪除都可以用smbldap-tool來(lái)完成。
因?yàn)槲夜纠镏挥形易约阂粋(gè)人管理這個(gè)服務(wù)器,如果我休息的時(shí)候?qū)τ诜羌夹g(shù)人員來(lái)管理LDAP服務(wù)器和Samba服務(wù)器來(lái)說(shuō)用這個(gè)密碼會(huì)有些麻煩,所以我還要向下寫(xiě),找了兩個(gè)GUI的工具來(lái)解決
============================華麗的分劃線(xiàn)============================
Samba管理工具Webmin,這個(gè)不用多介紹網(wǎng)上文章一大片,GOOGLE一下很多,也不是我介紹的重要,通過(guò)這個(gè)管理Samba服務(wù)器會(huì)很方便,不過(guò)用Webmin管理LDAP服務(wù)器的用戶(hù)和組我沒(méi)有設(shè)置成功,如果有調(diào)協(xié)成功的朋友,想請(qǐng)教一下
下面介紹LDAP Account Manager(以下簡(jiǎn)稱(chēng)LAM)這個(gè)GUI的管理工具,這個(gè)可以管理LDAP和Samba的用戶(hù),對(duì)我來(lái)說(shuō)特別重要的是可以建立home目錄,這點(diǎn)對(duì)于非技術(shù)人員管理LDAP和Samba服務(wù)器相當(dāng)重要。當(dāng)然你也可以說(shuō)用Webmin建立home目錄,不過(guò)那樣會(huì)讓非技術(shù)者相當(dāng)麻煩。
相信有很多人用phpldapadmin來(lái)維護(hù)LDAP,我開(kāi)始也是用這個(gè)工具來(lái)維護(hù)LDAP服務(wù)器,而且也感覺(jué)這個(gè)會(huì)比LAM來(lái)維護(hù)LDAP更簡(jiǎn)單一些,不過(guò)對(duì)于Samba來(lái)說(shuō)phpldapadmin不能管理這點(diǎn)有些不足,所以改用LAM。LAM的安裝很簡(jiǎn)單也是PHP的GUI,如果你以前裝過(guò)phpldapadmin的話(huà)那么LAM復(fù)制到apache的Document Root目錄下就可以運(yùn)行了。安裝過(guò)程請(qǐng)參看LAM壓縮包中的INSTALL文件。
在LAM的config需要修改一下lam.conf的配置文件,LAM也提供了GUI的修改頁(yè)面,這個(gè)很方便,下面是我用的配置文件
#more lam.conf
ServerURL: ldap://localhost:389
Admins: uid=admin,ou=Users,dc=yepn,dc=com
#這個(gè)地方很重要,如果你希望用LAM來(lái)建立home目錄,就需要給系統(tǒng)建立一個(gè)admin帳號(hào),所以這個(gè)地方不能設(shè)LDAP的root帳號(hào),而且這個(gè)admin帳號(hào)必需是unix系統(tǒng)中存在的用戶(hù)。
Passwd: {SSHA}DrIFykO6wONLf65+jmLeif8nbCA= buvDNg==
treesuffix: dc=yepn,dc=net
defaultLanguage: en_GB.utf8:UTF-8:English (Great Britain)
#這個(gè)地方的語(yǔ)言配置可以選中文,這點(diǎn)很方便
scriptPath: /usr/local/apache2/htdocs/lam/lib/lamdaemon.pl
#這個(gè)是非常關(guān)鍵的建立home目錄用的腳本文件
# Server of external Script
scriptServer: localhost
scriptRights: 750
cachetimeout: 5
# Module settings
modules: posixAccount_minUID: 1000
modules: posixAccount_maxUID: 3000
modules: posixAccount_minMachine: 5000
modules: posixAccount_maxMachine: 6000
modules: posixGroup_minGID: 1000
modules: posixGroup_maxGID: 2000
modules: posixGroup_pwdHash: SSHA
modules: posixAccount_pwdHash: SSHA
activeTypes: user,group
types: suffix_user: ou=Users,dc=yepn,dc=net
types: attr_user: #uid;#givenName;#sn;#uidNumber;#gidNumber
types: modules_user: inetOrgPerson,posixAccount,sambaSamAccount
types: suffix_group: ou=Groups,dc=yepn,dc=net
types: attr_group: #cn;#gidNumber;#memberUID;#description
types: modules_group: posixGroup,sambaGroupMapping
#types: suffix_smbDomain: ou=domains,dc=yepn,dc=net
#types: attr_smbDomain: sambaDomainName omain name;sambaSID omain SID
#types: modules_smbDomain: sambaDomain
# Access level for this profile.
accessLevel: 100
modules: sambaSamAccount_timeZone: 9
types: suffix_host:
types: attr_host: #cn;#description;#uidNumber;#gidNumber
types: suffix_smbDomain:
types: attr_smbDomain: #sambaDomainName;#sambaSID
改成你自己用LDAP域就OK了
現(xiàn)在登陸LAM就可以管理LDAP和Samba用戶(hù),但是還不能建立home目錄
[ 本帖最后由 gavinzhm 于 2008-4-11 16:32 編輯 ] |
|