A useful feature to have when working with multiple machines SSH-ing into one another is the password-less login. This is done using RSA pairs (public and private keys) as an alternative authentication method that can replace password authentication entirely.
Note that this can only be as secure as the RSA algorithms are, as long as you’re pretty much the only person who has physical access to those machines). So, as long as the server’s SSH daemon allows RSA/Pubkey authentication, all there is to do is generate some keys on the local machine and share them with the server (well, only the public one really):
- Generate the keys:
ssh-keygen -t rsa -C "username@hostname"
- Add the private key to the agent:
- Authorize public key on server:
At this point, you should be able to just
ssh server_user@server_address without any additional annoying password prompts. All of this can be extremely useful when working with Git remote repositories – and that’s a topic that will require multiple future posts, starting with this one.