Adding SSH Keys
Posted on Jul 3, 2017, 4:01 PM
Follow these steps to add SSH Keys:
- Generate private/public RSA key pair using:
You can use the defaults. The private key will be atssh-keygen -t rsa
~/.ssh/id_rsa
and the public at~/.ssh/id_rsa.pub
. - Copy the public key to the server using:
scp ~/.ssh/id_rsa.pub <username>@<host>:<filepath>/id_rsa.pub
- Login to the server using:
ssh <username>@<host>
- Add the public key to the host using:
In case of error try changing the file permission:cat <filepath>/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh/authorized_keys
And... Done!