Using Putty to login to a remote Linux host from Windows – Securely

Using Putty to login to a remote Linux host from Windows – Securely

Lets face it, most of us would prefer a Linux desktop but our boss says we must have Windows. No problem, we can still get to our beloved command line in Linux with Putty. This post will show you how to login via Putty and even configure it to use pki to automatically login.

Basic setup and usage of Putty

Lets begin by downloading the application and checking it’s md5 to make sure it has not been tampered with. This is an important step, do not skip it. Since we are doing this on a Windows machine we will use native tools to calculate the hash. First download the file from here. This is the only site you should trust since it is the developers site, always avoid getting binaries from sources other than the originator/creator. Make sure you scroll down to the bottom of the page and get the md5 and sha1 checksums. To check the hash you need Microsoft’s FCIV (File Checksum Integrity Verifier) utility. Download it from Microsoft and install it by first creating a FCIV directory then let it extract the files there. Open powershell and cd to the FCIV directory and execute the following:

./fciv.exe -md5 -sha1 c:\Users\your-user-name\Downloads\putty-64bit-0.70-installer.msi

The output should look something similar to this:

PS C:\Users\eda\FCIV> ./fciv.exe -md5 -sha1 C:\Users\eda\Downloads\putty-64bit-0.70-installer.msi
// File Checksum Integrity Verifier version 2.05.
                MD5                             SHA-1
983d8c71dd6eeed78012112b85734318 bc42729dc6f5c1089febbe139e2af09db9f0736d c:\users\eda\downloads\putty-64bit-0.70-installer.msi

Check the checksum files and make sure the file checksum on the list matches what you calculated. If there is any difference in the checksum’s the file is corrupt or has been tampered with. If all is good go ahead and install Putty. Launching Putty will result in the application opening with empty settings.

Initial Putty interface.

Here we are going to add our hosts and customize the settings and save them as a session for easy recall later. Lets start by adding our non-attributable system first. Start by adding the IP or Host Name, then type in a name for the session and click save.

Adding basic session information and saving it.

Now we can make any specific changes to this session by selecting the setting from the left side, making the change and hitting save. As an example I normally go into Window\Colours and select “Use system colours”, which provides a white background with the default Linux colors for directories, executable’s etc. 

Setting the colors for the session.

To start a session just select it by double clicking on the name of the saved session or single click and hit load.

Setting up Putty for automatic login

Now we are going to setup Putty so it will automatically login when you initiate a session to hosts you use on a regular basis. We will use a tool called puttygen, it is a key generator and was installed by default when you installed the putty package. The interface will look like this when you open it:

Puttygen interface.

Make sure the “RSA” radio button is selected then hit the “Generate” button and start moving your mouse around until it is finished. 

Key pair ready to be saved.

Save the public key to your Documents folder on your system, name it something like mypublickey with no extension. Now save the private key to a safe spot that is not publicly accessible. Again use a name similar to myprivatekey with no extension. You will get a warning dialog about not using a passphrase, just accept it.

Warning dialog about no passphrase.

Move your public key to the Linux machine you want to auto login too, use ftp, psftp or scp as appropriate. On the remote host execute the following command to append the public key to the authorized hosts file:

ssh-keygen -i -f edapublickey >> ~/.ssh/authorized_keys

Once the key is appended you can delete the key file:

rm edapublickey

Close out Putty and reopen it. When it opens select the session you are working on, load it and then select Connection\Data and enter your Linux username in the Auto-login username box. Once done navigate to \Connections\SSH\Auth and click the browse button to locate your private key.

Navigate back up to the session data and save the session by clicking the save button. Now all that’s left is to test the connection. Double click on the session and it should auto logon to the hosts.

If you have questions feel free to ask them in the comments below. I hope you enjoyed this blog post and found it useful, if you did please take a moment and give it a like. I enjoy doing tutorials and how-to’s on cyber security topics and as long as they are popular I’ll keep doing them.


Some of the links we provide on the site are affiliate links and your use of that link provides this site with needed funding to provide this free content; and we greatly appreciate it! Without your support we could not sustain the site.

See Ya

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu
Verified by MonsterInsights