SSH 连接上密码过期后 PuTTY 会话关闭

SSH 连接上密码过期后 PuTTY 会话关闭

我有一个 Ubuntu 8.10 版本,其中运行着 OpenSSH 版本 5.1p1。我创建了一个新用户帐户,设置了密码,然后使用以下命令使其过期:

chage -d 0 username

我想强制用户在第一次登录时更改其过期的密码。

当用户启动新的 PuTTY SSH 2 连接时,他们会输入用户名和正确的密码。但是,系统并未提示用户更改过期的密码,而是关闭会话并显示以下 PuTTY 致命错误:

“服务器意外关闭网络连接”

为了进一步调查,我使用以下命令在不同的端口上以调试模式启动了新的 sshd:

/usr/sbin/sshd -ddde -p 1022

然后我尝试登录这个新的 SSH 端口。这是我的输出:

debug1: userauth-request for user username service ssh-connection method password
debug1: attempt 1 failures 0
debug2: input_userauth_request: try method password
debug3: mm_auth_password entering
debug3: mm_request_send entering: type 11
debug3: mm_auth_password: waiting for MONITOR_ANS_AUTHPASSWORD
debug3: mm_request_receive_expect entering: type 12
debug3: mm_request_receive entering
debug3: monitor_read: checking request 11
debug3: PAM: sshpam_passwd_conv called with 1 messages
debug1: PAM: password authentication accepted for username
debug3: mm_answer_authpassword: sending result 1
debug3: mm_request_send entering: type 12
debug3: mm_request_receive_expect entering: type 49
debug3: mm_request_receive entering
debug3: mm_auth_password: user authenticated
debug3: mm_do_pam_account entering
debug3: mm_request_send entering: type 49
debug3: mm_request_receive_expect entering: type 50
debug3: mm_request_receive entering
debug1: do_pam_account: called
debug3: PAM: sshpam_passwd_conv called with 1 messages
debug3: PAM: do_pam_account pam_acct_mgmt = 7 (Authentication failure)
debug3: mm_request_send entering: type 50
Failed password for username from xxx.xxx.xxx.xxx port 2044 ssh2
debug3: mm_request_receive entering
debug3: mm_do_pam_account returning 0
debug1: userauth_send_banner: sent
Access denied for user username by PAM account configuration
debug1: do_cleanup
debug3: PAM: sshpam_thread_cleanup entering
debug1: do_cleanup
debug1: PAM: cleanup
debug3: PAM: sshpam_thread_cleanup entering

似乎我没有收到来自 的正确消息pam_acct_mgmt。我是不是没有以正确的方式使密码过期?我该如何解决这个问题?谢谢!

答案1

您可以只使用passwd -e username。该命令chage -d 0 username将上次登录设置为 1970 年 1 月 1 日。

相关内容