———- Local Machine ———-
1. Generate public key and private key
ssh-keygen -t rsa
2. Change .ssh folder permission
chmod 700 ~/.ssh
———- Remote Server ———-
1. Create authorized_keys file and change permission
mkdir ~/.ssh
touch ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
2. Copy id_rsa.pub content to ~/.ssh/authorized_keys
Reference:
https://om4.com.au/ssh-rsa-key-pairs-passphrases-leopard/
https://scotch.io/tutorials/how-to-setup-ssh-public-key-authentication