Score:0

Connection to Azure VM through SSH doesn't work all the way

jm flag

I have a development vm setup in a private network area in Azure. Now I'm trying to connect to it via SSH and it's failing for a certain reason. I'm sure that I uploaded the correct public key to the azure VM and that the username is also correct.

Azure Dev VM

vagrant@7XZRVZ2:~/.ssh/dev-vm$ ssh -vvvv -i /home/vagrant/.ssh/dev-vm/id_rsa [email protected]
OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n  15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 10.242.14.6 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/vagrant/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/vagrant/.ssh/known_hosts2'
debug2: ssh_connect_direct
debug1: Connecting to 10.242.14.6 [10.242.14.6] port 22.
debug1: Connection established.
debug1: identity file /home/vagrant/.ssh/dev-vm/id_rsa type 0
debug1: identity file /home/vagrant/.ssh/dev-vm/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
kex_exchange_identification: Connection closed by remote host
Connection closed by 10.242.14.6 port 22

It succeeds up to Local version string..., but then after 5 or 10s there is a kex_exchange_identification: Connection closed by remote host error which I do not understand. I searched for this error but not find a solution for my problem.

I checked the sshd logs in /var/log/auth.log on the Azure VM, in case of connection from client it just tells:

Mar 20 09:28:32 azureuser sshd[15871]: Connection from 10.236.122.24 port 31852 on 10.242.14.6 port 22 rdomain ""

I have setup a FW rule for Port 22 through the intranet network, is there probably another port I need to add?

ng flag
Just to confirm, the client you are trying to connect from is on the same network as the VM, or one that has connectivity to that network?
NFoerster avatar
jm flag
Yes the host of the VM is 10.242.14.6. I'm connected to the company intranet, the IP address is 10.236.122.24. Isn't the connection fine from the logs (Connection established)?
Score:0
jm flag

It was for real another firewall in company intranet. I was not aware of, as I can reach the server. If you encounter the same problems, check the firewalls again.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.