Setup passwordless ssh login to your Linux vps/remote Desktop

So you have a virtual private server that you have purchased from one of the providers like Digital ocean. You currently log into the server using ssh where you have to enter the password every time. It works ok but you tire of entering the password and wish there was a pass-wordless method to log in. This tutorial lays out how you can ssh into your server without having to enter your password using ssh-copy-id .

While on your terminal or wsl if you are using windows, generate a private and public key using the command ssh-keygen -t rsa -b 4096 -C "YOUR_EMAIL" .

The command will prompt you for a name and then generate a public key and a private key. You can find the keys in the ~/.ssh folder, if they are not in there they may have been saved directly to the home directory.

Navigate to the same directory where the keys are, in my case the keys were in ~/.ssh , the public key was named id_rsa.pub which was the default name after running ssh-keygen on my Ubuntu machine.

I then added the public key to the vps's authorized keys file using the command

ssh-copy-id -i ./id_rsa.pub yourname@REMOTE_SERVER_IP

The command ssh-copy-id is used to install a public key on a remote machine's authorized_keys file. This allows you to set up passwordless SSH login from your local machine to the remote machine.

After that you can ssh into your server and it will let you in without asking for a password, neat!