
我想為 Debian VM 上的使用者設定密碼策略,例如密碼所需的 minlen 和特殊字元。
在我的 Debian VM 中,我收到錯誤並且無法透過 SSH 再次登入該電腦。
作業系統版本:Debian Bullseye 11
核心版本:Linux 5.10.0-9-amd64 x86_64
修改設定檔 /etc/pam.d/common-password 從以下行開始:
# here are the per-package modules (the "Primary" block)
password [success=1 default=ignore] pam_unix.so obscure yescrypt
和插入類似於(https://www.networkworld.com/article/2726217/how-to-enforce-password-complexity-on-linux.html):
minlen=8 dcredit=1 ucredit=1 lcredit=1 ocredit=1
無需對該文件進行任何更改,我就可以毫無問題地進入計算機,例如公鑰已正確上傳、SSH 連接埠已開啟、SSH 和 SSHD 服務處於活動狀態。
當我再次嘗試透過 SSH 遠端連線時:
ssh -v USER@IP
我在最後幾行收到此錯誤:
debug1: Next authentication method: password
USER@IP's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.