2019-09-06 10:28:09 +01:00
|
|
|
# ssh-keyscan
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
> Get the public SSH keys of remote hosts.
|
2021-10-04 13:39:50 +01:00
|
|
|
> More information: <https://man.openbsd.org/ssh-keyscan>.
|
2019-09-06 10:28:09 +01:00
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Retrieve all public SSH keys of a remote host:
|
2019-09-06 10:28:09 +01:00
|
|
|
|
|
|
|
`ssh-keyscan {{host}}`
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Retrieve all public SSH keys of a remote host listening on a specific port:
|
2019-09-06 10:28:09 +01:00
|
|
|
|
|
|
|
`ssh-keyscan -p {{port}} {{host}}`
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Retrieve certain types of public SSH keys of a remote host:
|
2019-09-06 10:28:09 +01:00
|
|
|
|
2019-09-06 16:12:57 +01:00
|
|
|
`ssh-keyscan -t {{rsa,dsa,ecdsa,ed25519}} {{host}}`
|
2020-05-02 02:05:41 +01:00
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Manually update the SSH known_hosts file with the fingerprint of a given host:
|
2020-05-02 02:05:41 +01:00
|
|
|
|
|
|
|
`ssh-keyscan -H {{host}} >> ~/.ssh/known_hosts`
|