How can I add my host to known hosts manually?

2.9k views Asked by At

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.

1

There are 1 answers

0
peace_love On BEST ANSWER

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