Ssh asking for password; but then “Read from remote host … Connection reset by peer”

ssh

When I try to connect to remote server, ssh asks for password, checks it (if I put wrong password it will say "Permission denied") but doesn't let me in:

$ ssh user11@123
user11@123's password:

nothing happens, and some time later:

Read from remote host 123: Connection reset by peer

123 is hided server's ip.

Both ssh and sftp do this.

Remote is linux+OpenSSH and week ago ssh worked ok.

in -vvv mode I have after entry of password

debug3: packet_send2: adding 64 (len 58 padlen 6 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.

after some time…

debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t3 r-1 i0/0 o0/0 fd 4/5 cfd -1)

debug3: channel 0: close_fds r 4 w 5 e 6 c -1
Read from remote host 123: Connection reset by peer
debug1: Transferred: stdin 0, stdout 0, stderr 63 bytes in 117.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.5

Best Answer

There can be a few different causes of this, there's not enough information here to narrow down the problem exactly.

You'd have to check in your various log files on the server "123" in /var/log to see what's going on. This means checking out its console if you can't SSH to it.

An (incomplete) list of possible causes might be:

  • Some kind of runaway processes on your server filling up your process table, meaning it can't spawn your shell
  • Not enough RAM to spawn a shell.
  • Hard disk failure, meaning it can not load your shell from disk even though sshd might still be alive.
  • Your login shell set incorrectly to /bin/false or something
  • Somebody felt it would be funny to rm -rf / your server.
  • Some script kiddie tried to install a rootkit but botched it up to the degree that a shell won't launch.

Either way you're going to have to go to the console of the server to see what might be going on.