Last mod: 2024.10.25

How To Configure SSH key based authentication

A very convenient method of logging in via ssh is to use a priv/pub key pair. The advantages are even more apparent when we sometimes have to connect using scripts that automate various actions for us. We can quickly and easily configure auto-origination based on priv/pub asymmetric key cryptography.

Generate private ant public key pair:

user@host1:~$ ssh-keygen

ssh-keygen

Send public key to remote host:

user@host1:~$ ssh-copy-id user@host2

ssh-copy-id

Connect to remote host over private-=public key pair veryfication:

user@host1:~$ ssh host2

connect-without-password