How to Auto-Login to a Linux Server Using Public Key

This is a manual version of ssh-copy-id command.
Let’s say that we are logging in to server named B from a local machine named A.
First off, generate authentication key pair without passphrase on the local machine A:

1ssh-keygen -t rsa

Now you got a public key of your local machine, of which path is:

1cd ~/.ssh

Grab the public key to append it to the server’s file named authorized_keys.
If the file doesn’t exist, create one on the server like so:

1cd ~
2mkdir .ssh
3touch authorized_keys

Now you can login to the server B without any credentials from the local machine A.
Happy networking! 😎