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:
- Install VSCode using the User Installer.
- Install the VSCode Remote - SSH extension.
- Download Pageant and PuTTYgen.
- 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) andid_ed25519.pub
(public key). - 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 toppk
format by clicking the Save private key button. This conversion is necessary because Pageant only accepts keys inppk
format. Save it as%userprofile%\.ssh\id_ed25519.ppk
. Launch a terminal (cmd, PowerShell, or Windows Terminal) and execute the following command:
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.Edit your SSH config file located at
%USERPROFILE%\.ssh\config
. Insertinclude "pageant.conf"
as the first line. If you have anyIdentityFile your_private_ssh_file_path
lines in your config, remove them since Pageant will now manage your SSH keys.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.- To have Pageant start automatically when Windows boots, add it to your Startup folder. Press
Win+R
, typeshell: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, enterpageant.exe --openssh-config %USERPROFILE%\.ssh\pageant.conf %USERPROFILE%\.ssh\id_ed25519.ppk
(you may need to specify the full path topageant.exe
). Give the shortcut a name and click Finish.