TomDogg
TomDogg

Reputation: 3937

How to pass a known fingerprint to SSH (in order to avoid the manual prompt)

How do I pass a known fingerprint (such as SHA256:BcOkb1S0zuj5A1CDxpOSuD2hnAArV1A3wKY7iOlks) to SSH, so that I don't need to manually answer the prompt?

I tried the following, which does not seem to work:

ssh [email protected] <<EOF
SHA256:BcOkb1S0zuj5A1CDxpOSuD2hnAArV1A3wKY7iOlks
EOF

Upvotes: 2

Views: 1392

Answers (1)

VonC
VonC

Reputation: 1323045

To add to the comment "You could prepare the complete entry and then copy it to the ~/.ssh/known_hosts file.", that preparation would be done using ssh-keyscan:

ssh-keyscan -H 192.168.1.162 
# or
ssh-keyscan my-domain.com

If you have a known fingerprint, you can also double-check it, if is still valid.

Upvotes: 2

Related Questions