HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

ssh-keyscan — Get the public SSH keys of remote hosts. More information: <https://man.openbsd.org/ssh-keyscan>.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thekeyscommandsshclipublicgetssh-keyscan

Problem

How to use the ssh-keyscan command: Get the public SSH keys of remote hosts. More information: <https://man.openbsd.org/ssh-keyscan>.

Solution

ssh-keyscan — Get the public SSH keys of remote hosts. More information: <https://man.openbsd.org/ssh-keyscan>.

Retrieve all public SSH keys of a remote host:
ssh-keyscan {{hostname}}


Retrieve all public SSH keys of a remote host listening on a specific port:
ssh-keyscan -p {{port}} {{hostname}}


Retrieve certain types of public SSH keys of a remote host:
ssh-keyscan -t {{rsa,dsa,ecdsa,ed25519}} {{hostname}}


Manually update the SSH known_hosts file with the fingerprint of a given host:
ssh-keyscan -H {{hostname}} >> ~/.ssh/known_hosts

Code Snippets

Retrieve all public SSH keys of a remote host

ssh-keyscan {{hostname}}

Retrieve all public SSH keys of a remote host listening on a specific port

ssh-keyscan -p {{port}} {{hostname}}

Retrieve certain types of public SSH keys of a remote host

ssh-keyscan -t {{rsa,dsa,ecdsa,ed25519}} {{hostname}}

Manually update the SSH known_hosts file with the fingerprint of a given host

ssh-keyscan -H {{hostname}} >> ~/.ssh/known_hosts

Context

tldr-pages: common/ssh-keyscan

Revisions (0)

No revisions yet.