Assuming the following machines:
~/.ssh/id_rsa.pub
does not already exist do a:
ssh-keygen -t rsa… and copy the long single line that this file contains into your clipboard
~/.ssh/authorized_keys
(and make sure said file is readable).
NB 1:make sure to add an end-of-line at the end otherwise the file will be mangled
if you try to add an additional key using the more automated way described below.
Recently I did the following (source) and it worked like a charm (provided the ~/.ssh/authorized_keys
file at the destination machine ends with an end-of-line character (0x0A in real operating systems).
From the source machine:
ssh-copy-id -i ~/.ssh/id_rsa.pub youraccountname@destination.machine
I used the following (also from the source machine):
cat ~/.ssh/id_rsa.pub | ssh youraccountname@destination.machine "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"… as advised here. The advantage of this method is that it does not require the ssh-copy-id program to be installed on the source machine.
chmod 700 .ssh
chmod 640 .ssh/authorized_keys
PubkeyAuthentication yesBTW, it is actually considered a best practice to disable password-based authentication and only allow public key-based authentication, i.e. the exact opposite of what those admins are doing!