I am using ssh-keyscan
in a shell script to accept keys for hosts. The hosts are identified by hostname but not in /etc/hosts. They are in ./ssh/config
so I can ssh <hostname>
but I can not ping
etc.
It looks like ssh-keyscan
is not using the .ssh/config
file and that seems funny.
Can someone confirm this happens to them?
Real question: Does someone have a way to make ssh-keyscan use ~/.ssh/config?
ssh-keyscan doesn't and cannot be made to use
.ssh/config
.However, what you are asking for doesn't require it to do so: Simply passing the real hostnames/addresses to ssh-keyscan (and thus storing them in the known_hosts) will work, even if you use the aliases from the config with
ssh
. But you can even instruct ssh-keyscan to add other names to the output besides those it used to connect when using the-f
option:ssh-keyscan is a utility for gathering the public ssh host keys of a number of hosts. It was designed to aid in building and verifying
**ssh_known_hosts**
files. ssh-keyscan provides a minimal interface suitable for use by shell and perl scripts.For Example: