Ssh – Azure VM key fingerprint

azureazure-networkingsshvirtual-machines

I just created an Ubuntu VM on Azure. It says to use ssh to connect to the VM. When I try to SSH for the first time from the command line, it asks to verify ECDSA key fingerprint, but I cannot see it anywhere in the Azure Portal, whether it is the correct one of the machine I created.

Any help to find in Azure Portal would be much appreciated. Thanks.

Best Answer

it asks to verify ECDSA key fingerprint, but I cannot see it anywhere in the Azure Portal,

It is a by design behavior, just enter your password to login.

like this:

The authenticity of host 'HOST NUMBER DELETED)' can't be established.
RSA key fingerprint is 'blah blah blah blah blah blah blah'.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'myiphost' (RSA) to the list of known hosts.
root@myiphost's password: your_password

Update:

Here is my test:

VM1: jasoncli
VM2: jasonubuntu

I am try to use VM1 to SSH VM2, after SSH completed, Linux will record the target server's(VM2) host key to VM1 known_hosts, like this:

[root@jasoncli@jasonye ssh]# cat ~/.ssh/known_hosts 
10.168.172.115 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPeJQ8c7h002Flqu18aVYpUf+6HmXUS5UbMV7usyrrOUPyAMZcYBuek/DhEG2HmNAH0qLGurHdV66QCxM8oee1k=

We can find VM2's host key here:

root@jasonubuntu:/etc/ssh# cat ssh_host_ecdsa_key.pub 
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPeJQ8c7h002Flqu18aVYpUf+6HmXUS5UbMV7usyrrOUPyAMZcYBuek/DhEG2HmNAH0qLGurHdV66QCxM8oee1k= root@jasonubuntu
root@jasonubuntu:/etc/ssh# pwd
/etc/ssh

In this way, Linux will check the key to make sure the server is actually that server you are want to connect.


Update3:

For now, Azure does not support use console to connect to Azure VM. To get the ssh_host_ecdsa_key.pub, we can use custom script extension via Azure portal, like this:

enter image description here

Here is the script.sh:

cat /etc/ssh/ssh_host_ecdsa_key.pub

We can find the result in Azure portal:

enter image description here

Related Topic