无法在本地机器上使用密码 ssh 进入自己的帐户

无法在本地机器上使用密码 ssh 进入自己的帐户

我正在尝试调试 VirtualBox VM 上的 SSH 问题,但我看不出身份验证如何失败。首先,使用的密码是正确的(并且可以用于直接登录虚拟机),这个问题没有涉及到拼写错误。

我的用户行/etc/passwd(使用正确的shell,/bin/bash):

USERNAME:x:1000:1000:USERNAME,,,:/home/USERNAME:/bin/bash

/etc/ssh/sshd_config(所有未注释的行):

#Have tested with below line removed, no effect
AllowUsers USERNAME
Port 12345
SyslogFacility AUTH
LogLevel INFO
# Typically Pubkey instead, but this is for a setup script
PasswordAuthentication yes
ChallengeResponseAuthentication no
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
# Tried with "no" as well
UsePAM yes
# Also tested "KbdInteractiveAuthentication yes"

sudo service sshd status显示服务正在运行(以及自上次重启以来的失败尝试)。更改后,我总是sshd以类似的方式重启( ) 。sudo service sshd restart/etc/ssh/sshd_config

/var/log/auth.log

TIMESTAMP MACHINENAME sshd[21167]: Failed password for USERNAME from ::1 port 55920 ssh2
TIMESTAMP MACHINENAME sshd[21262]: Failed password for USERNAME from 127.0.0.1 port 50112 ssh2

~/.ssh是空的,但无论如何都有适当的权限(通过ls -lsa):

4 drwx------ 2 USERNAME USERNAME 4096 Jul 15 10:21  .ssh

最后,我通过禁用了所有防火墙sudo ufw disable

但即使连接(通过),我似乎仍然无法进行身份验证:ssh [email protected] -p 12345 -vvv

[email protected]'s password:
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
[email protected]'s password:

我还测试了/usr/sbin/sshd -D -p 12346作为辅助实例运行,但存在相同的身份验证问题。我曾让同一台虚拟机的多个实例与我使用的端口一起工作,并测试了几个端口(12345、17569、32101、45271、22、1337),但均无济于事。通信正常,但身份验证不正常。

我最初是从主机进行测试的,网络工作正常(我可以访问机器上的 Web 服务),但我在本地进行测试以尝试排除问题。什么原因可能导致了这个问题?有没有办法sshd更精细地调试服务?

相关内容