⬇ Importing from PuTTY ⬇ Importing from PuTTY

⬇ Importing from PuTTY

Dmitry Machulo Dmitry Machulo

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,
  3. import the resulted file into Termius.

Export from PuTTY

reg export HKCU\Software\SimonTatham\PuTTY\Sessions ([Environment]::GetFolderPath("Desktop") + "\putty-sessions.reg");

This command creates a 'putty-sessions.reg' file in the desktop directory.

Convert reg to SSH Config

$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
cat .\putty-sessions.reg |
where { $_ -match '("HostName")|("UserName")|("PortNumber")|(HKEY_CURRENT_USER.+Sessions\\)' } |
%{ if ($_ -match 'dword:') { $port= ($_ -replace '"','' -replace 'PortNumber=dword:', '0x'); " Port $($port -as [int])" } else { $_ } } |
%{ $_ -replace 'HKEY_CURRENT_USER.+Sessions\\', 'Host ' -replace '[\[\]]',''} |
%{ $_ -replace '"HostName"=',' HostName ' -replace '"UserName"=',' User ' -replace '"PortNumber"=',' Port ' -replace '"PublicKeyFile"=',' IdentifyFile ' } > ssh_config

Substitute '.\putty-sessions.reg' with the location of the 'putty-sessions.reg' file.

Putty.png
Converting from PuTTY

If you’re having any difficulties importing data, please, contact us 👨🏼‍🔧

Add comment

Please sign in to leave a comment.