Solved Unable to SSH into my FreeBSD VirtualBox Machine

Hello everyone!

I'm new to these forums and I've been trying to fix this issue since yesterday (I've been googling like crazy but haven't found a solution). I'm trying to SSH from my Linux Mint machine into my FreeBSD VirtualBox machine, I'm using NAT and my port-forwarding info is as follows:

Code:
 Name   Protocol   Host IP   Host Port   Guest IP   Guest Port  
FreeBSD   TCP     127.0.0.1     2222     10.0.2.15       22

When I attempt to SSH from my Linux Mint machine using: ssh -p 2222 127.0.0.1 -v I get:

Code:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222.
debug1: Connection established.
debug1: identity file /home/bicboi/.ssh/id_rsa type 1
debug1: identity file /home/bicboi/.ssh/id_rsa-cert type -1
debug1: identity file /home/bicboi/.ssh/id_dsa type 2
debug1: identity file /home/bicboi/.ssh/id_dsa-cert type -1
debug1: identity file /home/bicboi/.ssh/id_ecdsa type 3
debug1: identity file /home/bicboi/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/bicboi/.ssh/id_ed25519 type 4
debug1: identity file /home/bicboi/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1_hpn13v11 FreeBSD-20140420
debug1: match: OpenSSH_6.6.1_hpn13v11 FreeBSD-20140420 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 6c:53:cd:5f:c6:a8:a0:0e:b4:58:98:9f:98:c9:fb:a3
debug1: Host '[127.0.0.1]:2222' is known and matches the ECDSA host key.
debug1: Found key in /home/bicboi/.ssh/known_hosts:12
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/bicboi/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering DSA public key: /home/bicboi/.ssh/id_dsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering ECDSA public key: /home/bicboi/.ssh/id_ecdsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering ED25519 public key: /home/bicboi/.ssh/id_ed25519
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
Password for bicboi@DDAWG:
debug1: Authentications that can continue: publickey,keyboard-interactive
Password for bicboi@DDAWG:
Received disconnect from 127.0.0.1: 2: Too many authentication failures for bicboi

On my FreeBSD machine when this occurs the following output is output to the terminal :
Code:
 Sep 25 12:40:49 DDAWG sshd[727]: error: PAM: authentication error for illegal user bicboi from 10.0.2.2

DDAWG is my hostname on my FreeBSD machine, and bicboi is my username on my Linux Machine. My username on my FreeBSD machine is dsakhapo, so I tried sshing under that name but I get the same error.
I'm new to FreeBSD and VirtualBox so any help troubleshooting is greatly appreciated.

Also, I would paste my sshd_config file from my FreeBSD machine however, I haven't been able to get copy and paste working from VirtualBox so I'm unsure how to do that. Thanks again.
 
Hi, bicboi, welcome to FreeBSD and the forums. Your port forwarding in VirtualBox looks to be working fine. However, you said that the bicboi user doesn't exist on the FreeBSD guest system. This is the cause of the "illegal user" error when you try to log in as bicboi. You need to specify the remote username (that is, the name of the user on the FreeBSD guest, which you said is dsakhapo) when you connect from your Mint host:
ssh -p 2222 dsakhapo@127.0.0.1

Did you remember to set a password for the dsakhapo user? If the password is blank, the default SSH server configuration will not allow you to log in. If your FreeBSD guest is still printing the "illegal user" error (rather than a different error relating to an empty password) to the console as you suggest, check the dsakhapo user actually exists (and is spelt as you intended) by trying to log in as that user on the FreeBSD console.
 
Hi, bicboi, welcome to FreeBSD and the forums. Your port forwarding in VirtualBox looks to be working fine. However, you said that the bicboi user doesn't exist on the FreeBSD guest system. This is the cause of the "illegal user" error when you try to log in as bicboi. You need to specify the remote username (that is, the name of the user on the FreeBSD guest, which you said is dsakhapo) when you connect from your Mint host:
ssh -p 2222 dsakhapo@127.0.0.1

Did you remember to set a password for the dsakhapo user? If the password is blank, the default SSH server configuration will not allow you to log in. If your FreeBSD guest is still printing the "illegal user" error (rather than a different error relating to an empty password) to the console as you suggest, check the dsakhapo user actually exists (and is spelt as you intended) by trying to log in as that user on the FreeBSD console.

Thanks for replying, I do get the same error if I type the ssh command as you suggested. Whenever I boot up FreeBSD I'm prompted for a login and password to which I enter in dsakhapo and my password which is not blank.
 
Did you make changes from the default SSH daemon configuration (/etc/ssh/sshd_config)? If so, posting the configuration file would be useful. If you are running an SSH server on your GNU/Linux Mint host you could use scp(1) to copy it from the FreeBSD guest to your host system.
 
Did you make changes from the default SSH daemon configuration (/etc/ssh/sshd_config)? If so, posting the configuration file would be useful. If you are running an SSH server on your GNU/Linux Mint host you could use scp(1) to copy it from the FreeBSD guest to your host system.

I got it working. I just added
Code:
AllowUsers dsakhapo
to my sshd_config and it started working. I saw this solution online but it didn't occur to me to add dsakhapo instead of bicboi. Thanks for much for your help.
 
Back
Top