ssh服務(wù)的配置文件為 /etc/ssh/sshd_config
禁用密碼登錄
# 啟用密鑰驗證
RSAAuthentication yes
PubkeyAuthentication yes
# 指定公鑰數(shù)據(jù)庫文件
AuthorizedKeysFile .ssh/authorized_keys
# 禁用密碼驗證
PasswordAuthentication no
修改端口號
# 將默認的 22 端口改為 其他端口號
Port 51111
禁止空密碼登錄
PermitEmptyPasswords yes
優(yōu)化ssh連接過慢,DNS導(dǎo)致的問題
UseDNS no
GSSAPIAuthentication座掘,使ssh連接的更快
GSSAPIAuthentication no