- 求職 : Linux運維
- 論壇徽章:
- 203
|
MaxStartups 10表示可以有10個ssh的半連接狀態(tài),就像上面一樣.
這個選項一定要配合LoginGraceTime選項一起使用.
LoginGraceTime表示認證的時限,我們可以調(diào)整認證的時間限制,例如:
LoginGraceTime 20
即在20秒之內(nèi)不能完成認證,則斷開,如下:
ssh root@192.168.27.142
root@192.168.27.142's password:
Connection closed by 192.168.27.142
注意在這里如果密碼輸入錯誤,則重新計時,如果我們輸錯了密碼,計時將重新開始,幸運的是我們有MaxAuthTries,來解決認證次數(shù)的問題.
MaxAuthTries 1
這里表示只允許輸錯一回密碼.
我們要注意的是除了SSH自身的選項控制認證次數(shù)外,它還通過pam進行驗證,所以如果我們設(shè)置MaxAuthTries 10,則允許輸錯密碼的次數(shù)可能還是3,如果MaxAuthTries 2,則以MaxAuthTries為準.
如果是MaxAuthTries 2,我們輸錯密碼的提示如下:
ssh root@192.168.27.142
root@192.168.27.142's password:
Permission denied, please try again.
root@192.168.27.142's password:
Received disconnect from 192.168.27.142: 2: Too many authentication failures for root
grep MaxAuthTries /etc/ssh/sshd_config
#MaxAuthTries 6
|
|