![用户添加后服务器意外关闭网络连接Putty](https://linux22.com/image/600181/%E7%94%A8%E6%88%B7%E6%B7%BB%E5%8A%A0%E5%90%8E%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%84%8F%E5%A4%96%E5%85%B3%E9%97%AD%E7%BD%91%E7%BB%9C%E8%BF%9E%E6%8E%A5Putty.png)
添加用户后
[root@ctxsv-gl4j ~]# useradd -m mtteam
[root@ctxsv-gl4j ~]# passwd mtteam
Changing password for user mtteam.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@ctxsv-gl4j ~]#
putty:使用刚刚创建的‘mtteam’登录,我收到以下消息:
服务器意外关闭网络连接
注意:使用“root”登录效果很好
我希望用户不要以 root 身份登录,而是登录 su -mtteam。这是来自 /var/log/secure
Nov 8 09:05:23 ctxsv-gl4j sshd[5630]: pam_succeed_if(sshd:account): requirement "user ingroup tpt-it" not met by user "mtteam"
Nov 8 09:05:23 ctxsv-gl4j sshd[5630]: pam_succeed_if(sshd:account): requirement "user ingroup builders" not met by user "mtteam"
Nov 8 09:05:23 ctxsv-gl4j sshd[5630]: pam_succeed_if(sshd:account): requirement "user ingroup wheel" not met by user "mtteam"
Nov 8 09:05:23 ctxsv-gl4j sshd[5630]: pam_succeed_if(sshd:account): requirement "user ingroup gl_ctx_ssh" not met by user "mtteam"
Nov 8 09:05:23 ctxsv-gl4j sshd[5631]: fatal: Access denied for user mtteam by PAM account configuration
Nov 8 09:05:23 ctxsv-gl4j sshd[5630]: Failed password for mtteam from xxx.xxx.x.xxx port 62495 ssh2
Nov 8 09:05:40 ctxsv-gl4j sshd[5649]: Accepted password for root from xxx.xxx.x.xxx port 62523 ssh2
Nov 8 09:05:40 ctxsv-gl4j sshd[5649]: pam_unix(sshd:session): session opened for user root by (uid=0
)
答案1
伙计,请阅读你自己发布的错误。mtteam 需要成为这些组的成员,否则它将无法工作。(或者更改 PAM 配置)
答案2
检查 /etc/ssh/sshd_config 中是否存在且未注释的 AllowUsers,如果是,请在此处添加此用户。同时运行
grep mtteam /etc/passwd
并查看它是否具有有效的shell(例如/bin/bash)。