Setting up an RSA Key Pair for password-less authentication
September 15, 2017
Note:
This is an export from my old wordpress website, your comments or references might be lost during the migration. Sorry for the inconvenience.
By putting your public key on the remote servers, one can connect to them without passwords, the pairing private key on your local client will do the authentication work.
Generate an RSA Key Pair on your local machine
File location and passphrase will be asked while generating the RSA key pair. After that, we can find the public (id_rsa.pub) and private (id_rsa) keys under the ~/.ssh/ folder.
Install the public key to remote servers
By running this command, the content within the public key id_rsa.pub will be copied into the authorized_keys file on the remote server. Alternatively, we can just copy the content of ~/.ssh/id_rsa.pub on the client side, then append it at the end of the file ~/.ssh/authorized_keys on the server side. The following command 1 will do the same work:
Change the file and folder permissions of remote server2