ssh using keys (avoid password)

use public keys to authenticate 2 servers ”’Server1”’ and ”’Server2”’

=== on Server1 ===

generate keys
* do not input a password
* this will generate 2 files: ”id_rsa” (p[rivate key) and ”” (public key)
cd $HOME/.ssh
ssh-keygen -t rsa

add the public key to remote server
ssh-copy-id -i username@server2.local

=== on Server2 ===

this is optional, unless you also want server2 can ssh to server1 without password

ssh to server2 (from server1) and do the same thing again
ssh server2
cd $HOME/.ssh
ssh-keygen -t rsa
ssh-copy-id -i username@server1.local