Setting up WinSCP as an SFTP client on a Windows desktop

This article provides step-by-step instructions to install WinSCP on a Windows desktop computer, to use as an SFTP client to connect to a Linux server.

Objective

Install and configure WinSCP to establish an SFTP connection to a Linux server and transfer files between the Windows desktop and the Linux server.

Environment

Windows Desktop (Windows 10/8.1/8/7) does not have a native SFTP client program thus one needs to be installed in order to transfer files via the SFTP protocol. There are several SFTP clients available, such as WinSCP, CuteFTP, WS-FTP, and FileZilla. We chose WinSCP because it is available at no cost, while CuteFTP and WS-FTP both require the purchase of a license and FileZilla includes advertising components.

Procedure

  1. Download the WinSCP installation package from https://www.winscp.net.
  2. Start the installation by double-clicking on the downloaded file, typically named WinSCP-N.n-Setup.exe, where N and n are the major and minor version numbers, respectively.
  3. Chose default options to complete the installation, or see the vendor's documentation for a customized installation experience.
  4. Once installed, run WinSCP.
  5. WinSCP will open the "Login" window. Here, we will first create the public and private keys needed for key authentication, and then we'll setup the connection:
    1. On the Login window, click on Tools Run PuTTYgen:
      Login Window
       
      Login Window
    2. On the PuTTY Key Generator window, make sure the key type is RSA, and it contains 2048 bits.
      Putty Keygen
       
      Select key parameters
    3. Click on the Generate button. You will be prompted to move the mouse in the blank rectangle to generate randomness in the key. Keep moving the mouse until Puttygen has generated the key. The green progress bar will advance as you move the mouse.
      Key Randomness
       
      Move the mouse inside the red rectangle
    4. Once the keys have been generated, you are presented with the public key and the option to save the keys. In the Comment line, enter the name of the Linux server where you will upload the key. To encrypt the key itself, enter a password in the Key passphrase field. Then, click on the Save public key and Save private key to save the keys you've generated.
      puttykey
       
      Save the keys
    5. Now that the keys have been created and saved, you can close PuTTYgen, and return to WinSCP.
  6. The next step is to import the private key into Pageant. Pageant gives your WinSCP program access to the private key:
    1. Back at the Login window, click again on Tools and this time select Run Pageant.
      Run Pageant
       
      Run Pageant
    2. This action won't have an immediate visual effect, but, if you look at the icons near your clock, you'll notice a new icon present:
      Pageant Icon
       
      Locating the Pageant application
    3. Right-click on that icon, and select Add Key.
      Pagent add key
       
      Select Add Key in Pageant
    4. Navigate to the folder where you have saved the private key you created earlier, highlight the file, and click Open, then, enter the password for that key. Once the private key has been imported into Pageant, you will not need to enter this password again.
      Install Private Key
       
      Navigate to the saved private key
      Enter Private Key
       
      Provide the password to decrypt the private key
  7. Using key authentication requires that the public key already exist on the server. This clearly poses a dilemma — how do you authenticate with a key if you can't first upload the key? This is why the first time you log in to the server you have to login the old fashioned way, with a username and a password.

    Back at WinSCP's Login window, enter the server's address, along with your username and password. This is your regular UMICH set of credentials (some users may have more than one login).
    Conventional Login
     
    First time login using conventional credentials
    1. Once logged in, click on Session and select Install Public Key into Server.
      Install Public Key
       
      Uploading the public key to the Linux server
    2. Navigate to the folder where you stored the public key, and double click it. You should receive a confirmation as illustrated.
      Locate Public Key
       
      Navigating to the saved public key
      Public Key Confirmation
       
      Confirmation for public key upload
    3. Go to the main menu and select SessionNew Session.
      New Session
       
      Setup connection configuration using key authentication
    4. Fill out the Host name: and User name: fields, then click on the Save button. A new window will pop-up prompting you to enter a friendly Site name: and the option to Create desktop shortcut. This shortcut comes in very handy; you just double click it and it logs you in — no passwords to type, no addresses to lookup.
      Save Session
       
      Setup connection configuration and creating shortcut

Additional notes

Details

Article ID: 1681
Created
Wed 5/27/20 9:58 AM
Modified
Mon 8/31/20 10:02 AM