10

I've wanted to connect my share hosting with ssh. So I generate an ssh key in the ssh action of cpanel and authorized it. Then I've downloaded the private key and drop it in the ./ssh folder of my MacBook.I've used this code to connect my host.

ssh -p 2083  username@host IP

but I got this error:

kex_exchange_identification: Connection closed by remote host

How can I solve my problem?

Tom Newton
  • 91
  • 1
  • 6
Hanie Asemi
  • 1,318
  • 2
  • 9
  • 23
  • There can be many causes. One possibility is that the VM is shut down, which can easily happen in AWS or Azure if you have auto shutdown enabled. – james.garriss Jan 11 '22 at 12:48

4 Answers4

10

I run into a similar case with a small computer I have in my desk. What I did to debug the issue was to run sshd -t, which runs the sshd daemon in debug mode. This command reported that the permissions of my keys were invalid. All I had to do then was to go in the folder where the keys are stored and issue chmod 0600 <your_ssh_keys>. Maybe the action you run generated things with the wrong permissions too.

Carlos Moro
  • 116
  • 1
  • 4
2

I got this error when using docker command with remote host

docker -H ssh://user@server compose up

after some digging i found on my remote server in auth logs (/var/log/auth.log) this:

Aug  8 14:51:46 user sshd[1341]: error: beginning MaxStartups throttling
Aug  8 14:51:46 user sshd[1341]: drop connection #10 from [some_ip]:32992 on [some_ip]:22 past MaxStartups

This lead me to change MaxStartups settings in /etc/ssh/sshd_config. After restarting ssh service everything worked like a charm.

ondrados
  • 272
  • 3
  • 9
0

I had same problem and it was happend as I use ProxyCommand in ssh config file. In my case the Host was not defined correctly which then caused the same error!

Keivan
  • 1,300
  • 1
  • 16
  • 29
0

first, make sure if the hostname is correct. A typo either in the cmd or configfile gives this error.

then, check the sshd log in the host, to find the issues.

True
  • 419
  • 3
  • 7