2013-04-21 134 views
0

因此,我們有一個服務器,您可以SSH進入它。但是,我們設置了公共加密密鑰。我們希望只有通過身份驗證的密鑰才能登錄。沒有可能的方式使用密碼登錄。有沒有辦法做到這一點?將SSH設置爲僅使用密鑰,而不是密碼

編輯:

passwd -l account 

似乎使人們無法登錄到帳戶,而無需SSH密鑰。

回答

0

您可以嘗試將行PasswordAuthentication no添加到/ etc/ssh/sshd_config。可能取決於操作系統

2

將所有其他驗證類型no設置爲sshd_config

RSAAuthentication no 
PasswordAuthentication no 
UsePAM no 
KerberosAuthentication no 
GSSAPIAuthentication no