ssh-keyscan

SSH, known_hosts

Syntax

ssh-keyscan [options] hostname

Parameters

ParametersDescriptionExamplesLevel
-t ssh-keyscan -t ed25519 host Common
-p ssh-keyscan -p 2222 host Common
-H ssh-keyscan -H host >> ~/.ssh/known_hosts Advanced
-f ssh-keyscan -f hosts.txt Advanced
-T () ssh-keyscan -T 5 host Advanced

Examples

known_hosts

ssh-keyscan github.com >> ~/.ssh/known_hosts
CI/CD Common,

ssh-keyscan -t ed25519,rsa server.example.com
ed25519 and rsa

ssh-keyscan -f server_list.txt >> ~/.ssh/known_hosts

ssh-keyscan -H 192.168.1.100 >> ~/.ssh/known_hosts
known_hosts IP

Common Errors

getaddrinfo: Name or service not known, DNS IP
Connection timed out,

Tips

Related Commands