Import from MobaXterm

This article describes how to import data (sessions) from MobaXterm.

For that you'll need to:

  1. Export the data from MobaXterm as described here.

  2. Convert the exported file to an ssh config file (see below).

Convert from MobaXterm

Windows PowerShell
Windows PowerShell
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
$output=switch -regex -file '.\MobaXterm Sessions.mxtsessions'
{
"SubRep=(.*)" { $folder=$matches[1] }
"(.+)\s*=\s*#109#0%([^%]*)%(\d+)%([^%]*)%[^%]*%[^%]*%[^%]*%[^%]*%[^%]*%[^%]*%[^%]*%[^%]*%[^%]*%[^%]*%([^%]*)(%.*)?" {
$name=$matches[1]; $hostname=$matches[2]; $port=$matches[3]; $user=$matches[4]; $ssh_key=$matches[5];
if ($hostname) {
"Host `"$folder\$name`""
" Hostname $hostname"
if ($user) { " User $user" }
if ($port) { " Port $port" }
if ($ssh_key.Trim()) { " IdentityFile $ssh_key" }
}
}
}
$output > ssh_config

Substitute '.\MobaXterm Sessions.mxtsessions' with the location of the file created by MobaXterm.