I need to add a check if the hostname is already present in the known_hosts file.
Normally I would do something like that:
ssh-keygen -H -F hostname
However, that does not seem to work for me in this particular case. I connect to the host using port 2102, like that:
ssh user@myhost -p 2102
I was asked to add the hostname to the known_hosts file, I say yes. After that I run ssh-keygen -H -F myhost but receive empty result.
To make the matter worse, the known_hosts is hashed.
That works perfectly with port 22, so if I login to ssh user@myotherhost, save the known host and run ssh-keygen -H -F myotherhost I receive the exact line from the file.
So, how can I adjust the command to work with port 2102?