Unable to ssh to virtualbox, getting error

I keep getting this error when i try to ssh from my mac to the centos virtualbox.
kex_exchange_identification: read: Connection reset by peer

from terminal im sending ssh root@ -p 2222
i have set up the NAT port forwarding as follows
Host port 2222
Guest port 22

followed the lecture as is, but still not able to ssh

Which lecture are you following exactly?
Did you try logging in with a password? Did that work?
Since you’re trying to do passwordless login, did you copy your public ssh key to the VM before trying to connect?

Devops pre req - Chapter 3, Lab set up - Demo - connecting to vm on mac ( this is where i am)
I just tried the ssh, as per the lecture if I get connected to ssh it should ask me a password. but here i dont get connected and hence no password.

I dont know if i am doing passwordless login! how will i know?

edit: when i logged into centos on the virtualbox i used a password

True, pretty dumb of me to not realize that ssh would ask you for a password anyway.

In any case, seems like other people have had a similar issue:

Looks like you’ll have to go through the sshd logs on your VM, in order to figure out what’s going on there. Maybe the /var/log/auth.log can be of interest.

1 Like