sshterminalknown-hosts

How can I add my host to known hosts manually?


I try to add my host to known host via terminal:

ssh-keyscan -H 195.118.254.45 >> ~/.ssh/known_hosts

But when I open my known hosts file with text edit, then it is still empty. Nothing was added.


Solution

  • The working solution for me was:

    ssh-keyscan -H -p 2222 -t ecdsa 195.118.254.45 >> ~/.ssh/known_hosts
    

    I had to define the correct port