Introduction: Known Hosts is much like how the authorized_keys file is used to authenticate users the known_hosts file is used to authenticate servers. Whenever SSH is configured on a new server it always generates a public and private key for the server, just like you did for your user.
Procedure: You can generate known_host file by two methods.
- By Command prompt/Cygwin(tool).
- By Cloud Platform Integration.
In my case I will explain step by step solution through Command Prompt, as you same we have to follow it for Cygwin and after that I will explain you through Cloud Integration.
- Command Prompt:
- Install OpenSSHD
- Start menu -> run -> cmd -> ssh –V (for checking successful installation of OpenSSHD).
- Run Command -> ssh-keyscan –t rsa host_url/ip_address -> file name.
- The file will be generated.(as mentioned path. example: I navigated it to the D: drive)
PFB the snapshot, Command Prompt screen should be like this:
Note: If you are generating known_host file for your internal server then it can create it with this procedure, because in my case I was creating it for third party SFTP and I was able to generate known_host file but it was creating blank. If your file is creating blank follow Procedure 2.
- Cloud Platform Integration:
- Open Cloud Platform Integration (tenant) through S user Id and Password.
- After Logged In Navigate to -> Monitoring -> Connectivity test.
- Select SSH Connectivity test PFB,
4) Enter the following SFTP Host URL and test it and Authentication is none and Click Send.
5) You will receive the Success Response, Click on the Copy Host Key.
6) Host Key will be copied to your clipboard, create a text file, paste that copied host key into text file.
7) Rename the file and remove its extension .txt.
8) Yes, this is now your known_host file.
Hope it helps!