This tutorial details the steps to establish SSH authentication for connecting to a Linux machine from a Windows machine.
We assume that programs PuTTY and PuTTYgen are installed on the Windows machine.
- Generate a pair of SSH keys. If you already have them on the Linux machine, you can skip this step. Log in to a Linux machine and generate an SSH key pair named
id_rsabyssh-keygen -t rsa -f id_rsa -C yournameReplace
yournameby any comment you want. This will produce a public key fileid_rsa.puband a private key fileid_rsa. The public key needs to be in the~/.ssh/authorized_keysfile on any Linux machine you want to connect. -
Now we want to put the private key on the Windows machine so we can use it to connect to the Linux machine. You can use
WinSCPor any other program to transfer this file to your Windows machine, or simply copy the content ofid_rsaand paste to a text file on Windows. Let’s assume the private key file on Windows machine is still namedid_rsa. -
Unfortunately the private key format used by
PuTTYis different from that of Linux. We use thePuTTYgenprogram to convert it to an appropriate format forPuTTY. OpenPuTTYgen, go to menuConversions->Import Key, and select theid_rsafile. Click theSave private keybutton to save it as sayid_rsa_putty.ppk. This is the private key filePuTTYwill use. -
Open
PuTTY-
enter Host Name (or IP address)
-
From
Connection->Data, enter your username on the Linux machine toAuto-login username. -
From
Connection->SSH->Auth, load theid_rsa_putty.ppkfile toPrivate key file for authentication. -
From
Session, provide a session name toSaved Sessionsand clickSave. -
Now each time double-clicking the saved session will connect to the Linux machine via SSH key.
-