Quick Guide to ssh Keys
A quick guide for using ssh keys instead of passwords for ssh login.
ssh-keygen
generate a new ssh key with ssh-keygen command. Since RSA is being depricated use ecdsa or
ssh-keygen -f ~/.ssh/mynewkey-ecdsa -t ecdsa -b 521
It asks for adding password to it, leave it blank. If not managing lots of keys, but only using one, just use default filename without the -f
ssh-keygen -t ecdsa -b 521
ssh-copy-id
To copy the key to other linux hosts authorized_keys file
ssh-copy-id -i ~/.ssh/mynewkey-ecdsa bob@192.168.33.44
in Windows the ssh-copy-id command does not exist, so instead you can use this workaround
and then you can reference the keys in your ssh config file, for even easier login. If using default keyname then this is not required.
Example ~/.ssh/config
Host myserver1 myserver1.mydomain
Hostname 192.168.33.44
user bob
IdentityFile ~/.ssh/mynewkey-ecdsa
Host myserver2 myserver2.mydomain
Hostname 192.168.33.55
user bob
IdentityFile ~/.ssh/mynewkey-ecdsa
Test the configuration
then you can login using the key simply with
ssh myserver1
Further Reading
For more info on using ssh-keygen and ssh-copy see Redhat RHEL9 admin guide or Ubuntu24 openssh-server guide