Skip to content

Authentication preparation

Key generation

Generate a new 256-bit ECDSA key,

ssh-keygen -t ecdsa -b 256 -C '' -N '' -f root.key

Remove the public key file that was created alongside the specified root.key file,

rm --verbose root.key.pub

(Later) retrieval of the public key can be done with...

ssh-keygen -y -f root.key

Key loading

To load the generated SSH key into an ssh-agent process running on the SSH client, run

ssh-add $(readlink --canonicalize root.key)

The path canonicalization contributes to the output quality of ssh-add -l.

Connection refresh

ADDRESS=10.5.2.0
ssh-keygen -R $ADDRESS
ssh-keyscan $ADDRESS 2>/dev/null \
    | grep ^$(sed s/\\./\\\\./g <<<$ADDRESS)' ' \
    >> ~/.ssh/known_hosts