Import from PuTTY
This article describes how to import data from PuTTY.
For that you'll need to:
    1.
    Export the data from PuTTY, which is stored in the registry.
    2.
    Convert it into an ssh config file.

Export from PuTTY

Windows PowerShell
1
reg export HKCU\Software\SimonTatham\PuTTY\Sessions ([Environment]::GetFolderPath("Desktop") + "\putty-sessions.reg");
Copied!
This command creates a 'putty-sessions.reg' file in the desktop directory.

Convert reg to SSH Config

Windows PowerShell
1
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
2
cat .\putty-sessions.reg |
3
where { $_ -match '("HostName")|("UserName")|("PortNumber")|(HKEY_CURRENT_USER.+Sessions\\)' } |
4
%{ if ($_ -match 'dword:') { $port= ($_ -replace '"','' -replace 'PortNumber=dword:', '0x'); " Port $($port -as [int])" } else { $_ } } |
5
%{ $_ -replace 'HKEY_CURRENT_USER.+Sessions\\', 'Host ' -replace '[\[\]]',''} |
6
%{ $_ -replace '"HostName"=',' HostName ' -replace '"UserName"=',' User ' -replace '"PortNumber"=',' Port ' -replace '"PublicKeyFile"=',' IdentifyFile ' } > ssh_config
Copied!
Substitute '.\putty-sessions.reg' with the location of the 'putty-sessions.reg' file.
Converting from PuTTY
Last modified 9mo ago