Skip to content

Using Pageant with VSCode Remote SSH#

While Putty and Pageant are widely used tools for SSH connections, you can also integrate Pageant with VSCode to establish remote SSH connections without administrative privileges. While the default ssh-agent service offers similar functionality, it's disabled by default and requires administrative access to start if disabled, making Pageant a more flexible alternative. Here's how you can set it up:

  1. Install VSCode using the User Installer.
  2. Install the VSCode Remote - SSH extension.
  3. Download Pageant and PuTTYgen.
  4. Generate an OpenSSH format SSH key pair if you don't have one yet. Using a passphrase is highly recommended for security. After this step, you should have two files: id_ed25519 (private key) and id_ed25519.pub (public key).
  5. Run puttygen, open Conversions -> Import key, and load your OpenSSH format private key (the one without the .pub extension) created in the previous step. This file is typically located in the %userprofile%\.ssh folder. Export it to ppk format by clicking the Save private key button. This conversion is necessary because Pageant only accepts keys in ppk format. Save it as %userprofile%\.ssh\id_ed25519.ppk.
  6. Launch a terminal (cmd, PowerShell, or Windows Terminal) and execute the following command:

    pageant.exe --openssh-config %USERPROFILE%\.ssh\pageant.conf %USERPROFILE%\.ssh\id_ed25519.ppk
    

    Note: Adjust the path to your PPK file if it's stored in a different location.

    Upon successful execution, the Pageant icon will appear in your system tray. If you can't see the icon, you may need to configure Windows to show all system tray icons - follow this guide for instructions. To verify that your key is properly loaded, right-click the Pageant icon and select View Keys - you should see id_ed25519.ppk listed.

  7. Edit your SSH config file located at %USERPROFILE%\.ssh\config. Insert include "pageant.conf" as the first line. If you have any IdentityFile your_private_ssh_file_path lines in your config, remove them since Pageant will now manage your SSH keys.

    A simple example for %USERPROFILE%\.ssh\config
    include "pageant.conf"
    
    Host *
        User your_username
    
  8. Open VSCode, click View -> Command Palette -> Remote-SSH: Connect to Host, and enter user@hostname. You should now be able to connect to your remote SSH machine.

  9. To have Pageant start automatically when Windows boots, add it to your Startup folder. Press Win+R, type shell:startup to open the Startup folder for your current user. Create a new shortcut by right-clicking and selecting New -> Shortcut. In the location field, enter pageant.exe --openssh-config %USERPROFILE%\.ssh\pageant.conf %USERPROFILE%\.ssh\id_ed25519.ppk (you may need to specify the full path to pageant.exe). Give the shortcut a name and click Finish.

Comments