轉到內容

Linux 指南/Linux 中的 LDAP 驗證

來自維基文庫,開放世界的開放書籍

僅在 Fedora Core 4 上進行了測試


1. 安裝以下 RPM

  openldap-2.2.23-5.i386.rpm
  openldap-clients-2.2.23-5.i386.rpm
  openldap-servers-2.2.23-5.i386.rpm

2. 配置並啟動 OpenLDAP

  Edit file /etc/openldap/slapd.conf and change 3 settings
  1. suffix  "dc=example,dc=com"
  2. rootdn  "cn=manager,dc=example,dc=com"
  3. rootpw  yourrootpassword
  
  To Start OpenLDAP run command  service ldap start

3. 使用轉換指令碼從 /etc/passwd/etc/group 建立 ldif 檔案

轉到目錄 /usr/share/openldap/migration

編輯 migrate_common.ph 並更改 2 個設定

  1. $DEFAULT_MAIL_DOMAIN = "example.com";
  2. $DEFAULT_BASE = "dc=example,dc=com";

在 /root 目錄中使用以下命令建立 3 個 ldif 檔案

  ./migrate_group.pl /etc/group /root/group.ldif
  ./migrate_passwd.pl /etc/passwd /root/passwd.ldif
  ./migrate_base.pl > /root/base.ldif

4. 將 ldif 檔案匯入到 OpenLDAP

   ldapadd -cx -D "cn=manager,dc=example,dc=com" -w yourrootpassword -f /root/base.ldif
   ldapadd -cx -D "cn=manager,dc=example,dc=com" -w yourrootpassword -f /root/passwd.ldif
   ldapadd -cx -D "cn=manager,dc=example,dc=com" -w yourrootpassword -f /root/group.ldif

5. 使用 authconfig 為 Linux 配置 ldap 驗證

   as root, run command authconfig
   on first screen, select Use LDAP  and Use LDAP Authentication
   On Next screen, Type Server: 127.0.0.1 Base DN: dc=example,dc=com

-Swapnil(2005 年 12 月 09 日,星期五)電子郵件- swapnil_durgade@yahoo.com

華夏公益教科書