設定 Kerberos 驗證的 SSH

OpenSSH 同時支援通訊協定版本 1 和 2 的 Kerberos 驗證。在版本 1 中,會有特殊通訊協定訊息來傳輸 Kerberos 票證。版本 2 不再直接使用 Kerberos,而是依靠 GSSAPI (一般安全性 API,General Security Services API)。這是一種非 Kerberos 特定的程式設計介面 — 它設計用來隱藏基礎驗證系統 (如 Kerberos)、公開金鑰驗證系統 (如 SPKM) 或其他系統的特質。但是,包括在其中的 GSSAPI 程式庫僅支援 Kerberos。

若要以 Kerberos 驗證使用 sshd,請編輯 /etc/ssh/sshd_config 並設定下列選項:

# These are for protocol version 1 
#
# KerberosAuthentication yes
# KerberosTicketCleanup yes

# These are for version 2 - better to use this
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes

然後使用 rcsshd restart 重新啟動您的 SSH 精靈。

若要以通訊協定版本 2 使用 Kerberos,請同時在用戶端啟用它。可在 /etc/ssh/ssh_config 涵蓋整個系統的組態檔中編輯,或在 ~/.ssh/config 個別使用者層級來編輯。在兩種方式,都請新增選項 GSSAPIAuthentication yes

現在您應該可以使用 Kerberos 驗證來連線。使用 klist 以確認您擁有有效票證,然後連線到 SSH 伺服器。若要強制 SSH 通訊協定版本 1,請在指令行指定選項 -1

[Tip]其他資訊

/usr/share/doc/packages/openssh/README.kerberos 檔案討論 OpenSSH 和 Kerberos 互動的詳細資訊。