在Debian 7 中安裝LDAP Client

在Debian 7 中安裝LDAP Client

繼上一篇使用AutoFS 來連上NFS server 存取我file server 上的資料後, 接下來就是處理帳號的問題. 由於我的帳號是用LDAP server 來管理, 因此最近安裝的Debian 7 也需要安裝LDAP client .

安裝必要套件

# apt-get install ldap-utils libpam-ldapd nscd nslcd libnss-ldapd

安裝期間, 它會詢問你的LDAP server URI, 請依據你的LDAP server 輸入server 的URI, 可以是下列三種格式

ldap://<hostname_or_IP_address>:<port>/
ldaps://....
ldapi://....

其中 是optional, 可以不用輸入. 我的LDAP server URI 是

ldap://192.168.x.xxx/

接下來他要你輸入LDAP server search base, 格式如下:

ou=xxxx, dc=example,dc=net

請依照你的LDAP server 的設定來輸入, 我的search base 是:

ou=nis,dc=mydomain,dc=net

在接下來, 它會去修改你的/etc/nsswitch.conf 裡面的欄位, 他會問你有要修改哪些欄位, 請依據你的LDAP server 有存放哪些資訊來決定. 因為我的LDAP server 只存放使用者帳號和密碼 用來取代NIS用而已, 因此我只挑選下列欄位:

password
shadow
group

OK! 這樣就設定好了.

要確認是否設定成功, 你可以使用getent 指令去查看使用者資訊,

# getent passwd    

若是有看到server 上的使用者資訊, 那表示已經已經可以連接上LDAP server了.

若是你需要更詳細的設定, 可以自己去修改下列的設定檔:

/etc/ldap/ldap.conf
/etc/nslcd.conf
/etc/nsswitch.conf
/etc/pam.d/common-account
/etc/pam.d/common-auth
/etc/pam.d/common-password
/etc/pam.d/common-session

參考資料

  1. Debian LDAP NSS
  2. Debian LDAP PAM
  3. Ubuntu LDAPClientAuthentication
  4. LDAP Client on Ubuntu
This entry was posted in Linux and tagged , , . Bookmark the permalink.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *