ssh-keyscan — collecting host keys
cheat sheet · OpenSSH 9.6 https://lab.dimsanych.ru/en/wiki/ssh-keyscan/Cheat sheet
-
ssh-keyscan server.example.comthe host's public keys (to stdout) -
ssh-keyscan -H server.example.com >> ~/.ssh/known_hostsadd, hashing the hostname -
ssh-keyscan -t ed25519 server.example.comonly one key type -
ssh-keyscan -p 2222 server.example.comnon-standard port -
ssh-keyscan -f hosts.txta list of hosts from a file -
ssh-keygen -lf <(ssh-keyscan server.example.com 2>/dev/null)fingerprints to verify
Options
Below are the main flags; the full list is in man ssh-keyscan.