Import from MobaXterm

This article describes how to import data from MobaXterm.

For that you'll need to:

  1. Export your sessions from MobaXterm to a file – MobaXterm Sessions.mxtsessions.

  2. Convert data from MobaXterm into an ssh config file – ssh_config.

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