ssh登录失败,查看/var/log/messages日志中发现如下记录:
Jan 11 11:10:46 localhost sshd[18048]: error: PAM: Permission denied for illegal user gkgk from x.x.x.x
Jan 11 11:10:46 localhost sshd[18048]: Failed keyboard-interactive/pam for invalid user gkgk from x.x.x.x port 15501 ssh2
原因说明:
gkgk用户没有加入AllowGroups允许访问ssh的用户组,需要将该用户加入sshonly分组。
cat /etc/ssh/sshd_config | grep -i allow
AllowGroups sshonly sftponly
//id gkgk
uid=5002(gkgk) gid=100(users) groups=100(users)
//id weihu
uid=6668(weihu) gid=100(users) groups=100(users),10(wheel),7001(sshonly)