What’s different between nscd, nslcd and sssd

Jerry’s Notes
What’s next?
Published in
3 min readMay 6, 2019

有很長的一段時間搞錯了nscd, nslcd and sssd這三個服務之間的差異!!

下面是這三個服務的基本定義說明

  • nslcd:Daemon for NSS and PAM lookups using LDAP(nss-pam-ldapd)
  • nscd:name service cache daemon,
  • Nscd provides caching for: passwd, group, hosts databases through standard libc interfaces (getpwnam, getpwuid, getgrnam, getgrgid, gethostbyname, and others).
  • sssd: System Security Services Daemon

簡單來說 nslcd 跟sssd都是用於Liunx認證用的套件, 但nscd只用於在Client DSN cache快取資料用的。但sssd也有快取的功能(這部份是最容易被誤解的)。

NSCD只支持緩存4種名稱服務:passwd, group, hosts and services entries.

SSSD 只支持緩存3種名稱服務:passwd, group, and netgroup entries.

NSCD and SSSD若同時使用, 會有問題,但如果又需要Client DNS cache時,要如何解決,Redhat有建議做法如下:

$ vi /etc/nscd.conf

  • enable-cache hosts yes
  • enable-cache passwd no
  • enable-cache group no
  • enable-cache netgroup no

開啟NSCD DNS緩存服務的優點和缺點

優點:

1. 本地緩存DNS解析信息,提供解析速度。

2. DNS服務掛了也沒有問題,在緩存服務時間範圍內,解析依舊正常。

缺點:

DNS解析會變慢,如域名解析更改需要手動刷新緩存,NSCD不適合做快速FQDN切換的應用,目前對於依賴DNS切換的服務,建議不要開啟DNS緩存。

在Linux要使用Client DNS cache, 除了NSCD,還建議使用 DNSMASQ

--

--

Jerry’s Notes
What’s next?

An cloud support engineer focus on troubleshooting with customer reported issue ,and cloud solution architecture.