client —–> server
create the client’s ssh key (if not existing already)
ssh-keygen -t rsa
if you’re adding the first key, just copy the public key ~/.ssh/id.rsa_pub to the server
scp ~/.ssh/id_rsa.pub user@server:.ssh/authorized_keys2
to append another key, use:
cat ~/.ssh/id_rsa.pub | ssh user@server 'sh -c "cat - >>~/.ssh/authorized_keys2"'