Add SSH Keys to authorized_keys file

Posted on September 24, 2018
PHP
cat ~/.ssh/id_rsa.pub

Copy the key from terminal. Then, login to server.

sudo vi ~/.ssh/authorized_keys

Paste your key. Done! Or,

cat ~/.ssh/id_rsa.pub | ssh USER@HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Done!!