Generate SSH keys
ssh-keygen -C email@example.com
Authorize public key at remote server
On Mac OSX,
ssh-copy-id should be installed first.
brew install ssh-copy-id
ssh-keygen -f ~/.ssh/id_rsa -e -m pem > ~/.ssh/id_rsa.pem
Copy file by base64
On remote session, run
base64 < myfile and copy the output.
On local terminal, run
base64 -d > myfile, paste the content and press