How to check if a provider is on . ssh/known_hosts?

Asked

Viewed 199 times

0

I have a script that synchronizes git repositories. If the repository has never been synchronized, directories are created.

Eventually, when a repository is added, the server serving the repository is not listed in the archive .ssh/known_hosts and the ssh client does not proceed as it is necessary to confirm the inclusion of the public key in the archive.

How do I check if the server is already listed on .ssh/known_hosts?

2 answers

4


Just run the command ssh-keygen -H -F <hostname>. The command returns the line the hostname is included in, or returns nothing if it does not find.

0

You can run before:

awk '{print $1}' .ssh/known_hosts 

And see which hosts are known.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.