0

I am attempting to debug an issue with SSH on a VirtualBox VM, and I'm not seeing how the authentication could be failing. First and foremost, the password in use is correct (and can be used to log into the VM directly), there are no typos involved with this question.

My user line in /etc/passwd (with the correct shell, /bin/bash):

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

/etc/ssh/sshd_config (all uncommented lines):

#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 shows the service is running (and previous failed attempts since last restart). I always restart sshd in a similar manner (sudo service sshd restart) after changing /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 is empty, but has appropriate permissions anyhow (via ls -lsa):

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

Lastly, I disabled any firewall via sudo ufw disable.

But even when connecting (via ssh [email protected] -p 12345 -vvv), I still seem to be unable to authenticate:

[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:

I also tested against running /usr/sbin/sshd -D -p 12346 as a secondary instance, with the same authentication issue. I have had separate instances of this same VM working with the ports I've used, and have tested several (12345, 17569, 32101, 45271, 22, 1337) to no avail. The communication is there, but the authentication is not.

I was originally testing from the host machine, with the networking working correctly (I can access a web service on the machine), however I tested locally to attempt to rule out issues. What could be causing this issue, and are there means to debug the sshd service more finely?

4
  • When you use the command ssh [email protected] -p 12345 -vvv) are you in a terminal of the host computer or the the terminal of the VM guest computer? If you are in the terminal of the host computer, you are in the wrong place for 127.0.0.1, as that points to the host computer itself. If you are in the terminal of the guest computer (of the guest you are testing ssh, then you have a problem. I suggest you start with the default version of /etc/ssh/sshd_config and try simple ssh 127.0.0.1 from within the same VM guest computer where the ssh server is installed.
    – user68186
    Jul 15, 2022 at 15:20
  • A terminal of the VM guest computer. Any good way of generating a fresh sshd_config?I suppose I could uninstall/reinstall it, though this is a production VM with the apt list removed.
    – Rogue
    Jul 15, 2022 at 15:41
  • 1
    The command sudo apt purge openssh-server followed by sudo apt install openssh-server should do the trick. You should not run production VMs without keeping a backup of the config files you modify. For the future use something like sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original.
    – user68186
    Jul 15, 2022 at 15:47
  • What I meant by a production VM is that by default it's fairly "locked down" (not necessarily deployed to production). True enough about keeping backups, but I can always wipe the machine and start over. I'll have to re-add the apt sources to test a reinstall, one moment.
    – Rogue
    Jul 15, 2022 at 15:50

0

You must log in to answer this question.

Browse other questions tagged .