I'm running two OSes, one (Backtrack 5) as a guest in VirtualBox and the other (Ubuntu 13.04) as the host. Now when I connect to my host through ssh (host-only connection):

$ ssh 198.168.*.* -vvv

I'm prompted for a password and when I enter the password I get the following error occurs:

debug3: packet_send2: adding 64 (len 58 padlen 6 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug3: Wrote 144 bytes for a total of 1271
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

I've tried it again and again so I know that my password isn't wrong. On my host machine when I type:

$ ssh localhost

it connects normally after typing the password, but when I issue this on guest it says:

Read from socket failed: Connection reset by peer
Connection closed by UNKNOWN

What is the problem?

edit: the first of my problem was I was trying

ssh ip

but it should be

ssh username@ip

cant connect to host though. Its refusing the connection

closed as unclear what you're asking by roaima, Jeff Schaller, Stephen Rauch, GAD3R, Scott Aug 28 '17 at 5:33

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • if possible, also post messages of auth.log and syslog – Rahul Patil Jul 10 '13 at 9:26
  • Does anything appear in the logs on the server (/var/log/auth.log)? What do you have in the server configuration: /etc/ssh/sshd_config? Is there a firewall on the guest or on the host? What kind of network do you have in the VM (bridge, NAT, host-only) — can you connect from the guest to the host at all? – Gilles Jul 10 '13 at 14:43
  • show the full command for ssh, what parameters you use? – ilansch Aug 27 '17 at 20:07

A possible cause is an expired account (which can be inspected by doing: chage -l

In my case I was accessing a system that I knew worked well for many users, except for two of them.

The local file (/etc/shadow) had a bad value for the these users. Fixed by running chage interactively.

This was not evident, just a harsh "Connection closed by UNKNOWN" or a "Permission denied" and I had no access to logs on the server side to troubleshoot. Running ssh in verbose/debug mode on the client didn't help much.

Not the answer you're looking for? Browse other questions tagged or ask your own question.