Secure File Transfer using PuTTY

This page is about setting up the program sftp for secure file transfer using the ssh protocol. More specifically, it's about installing and using the version of sftp that's part of the open source, freely available PuTTY package for Windows PC's. MAC or Linux PC's usually have a version of sftp already built in, so setup is simpler: see the companion page ssh_mac_linux for that.

The ssh protocol allows use of a public/private key pair instead of a login password , and it encrypts file transfers, so an eavesdropper cannot intercept them. When the user requests a file transfer, the server can verify that the user has the private key without needing to know the actual contents of the key. A Google search on "Public Key Cryptography" will provide details about how this mathematical magic works. For purposes of this writeup it's sufficient that it's generally considered reliable as long as the private key really remains private.

Security is a complex problem; these notes are not intended for critical situations or when there are specific legal or financial requirements for privacy.

Setup and use of PuTTY includes the following steps (each is described in more detail below):

Each step is explained in the following sections.

Get and install PuTTY.

The first step is to download and install the PuTTY suite of programs from www.chiark.greenend.org.uk/~sgtatham/putty/download.html . Download putty-0.62-installer.exe and run it to start the installer. Here are sample install settings that I used: Most are defaults. A full sequence of screenshots are included at the end of this document.

After the install is complete, programs are available in the PuTTY folder:
Windows Start button → All Programs → PuTTY folder

Generate key pair

Next we need to generate the keypair: Click the windows Start button, type "puttygen" in the search box, and click on it to start it.

Click the "Generate" button and follow the instructions. The program will generate and display the new public key as shown in the screenshot above. We need to do two things with the new key pair

These steps only need to be performed once.

Pageant: activating the private key.

First select the private key: From the Windows Start button, search for and execute "pageant.exe". The program will quietly insert an icon in the system tray (the lower right-hand corner of the screen). It's the PC-with-a-hat icon circled in red in this screenshot.

Double-click the icon to bring up the Pageant menu, select "load key" and select the desired private key - key1priv.ppk in this example. You can then click "close" to get rid of this window. Pageant only needs to be run once and remains active until the PC is shut down.

psftp: Transferring files to and from the remote system.

To transfer files, first start the program sftp.exe. It should bring up a window with a command prompt:

The main commands are

Note: if psftp asks for a password after the open command, then something is wrong with the key file setup. Probably either pageant isn't running or the remote server doesn't have the public key properly installed.


Supplemental Info: Setup Screenshots

Here's an example of running putty-0.62-installer.exe on Windows Vista.






Last revision $Id: ssh_putty.html,v 1.5 2013/03/01 03:15:54 jrothwei Exp $