Convert Putty .ppk files including sessions to OpenSSH

descriptionStandard

This post covers several Bash scripts that can be used to convert Putty .ppk files to a Linux compatible OpenSSH format.

There are 3 OpenSSH/PPK focused helper scripts within the repository:

  • convert_ppk.sh:
    Primary scripts used to convert Putty .ppk files to OpenSSH compatible format.
  • convert_putty_session.sh:
    Additional script that converts putty-session.reg registry key exports to Remmina compatible configurations.
  • sync_openssh_remmina.sh:
    Additional script that can sync Remmina configurations to OpenSSH (~/.ssh/config) and vice-versa.

Design purpose

This article aims to aid users transitioning from Windows to Linux environment working with SSH workflows involving Putty.

  1. Remmina is used to provides a GUI with access to SSH connection similar to Putty.
    Users with a preference for a GUI may prefer this approach.
  2. Conversion scripts for converting Remmina profiles to OpenSSH with identities.
    Users preferring a CLI based approach may prefer this approach.

One last note; Remmina does not need to be installed prior. The profiles generated are simple config like text files with the extension: .remmina.

Converting Putty PPK’s to OpenSSH

This script converts Putty PPK files to OpenSSH private and public keys:

Converting Putty Sessions to Remmina Profiles

This script can generate Remmina profiles from a Putty session registry export (.reg coming from Windows):

convert_putty_session.shView rawView file on GitLab

Exporting sessions on Windows

Windows users can use the following PowerShell to export the Putty session registry key to the Desktop.

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

Converting Remmina profiles to OpenSSH

This script can generate SSH configuration from Remmina profiles.

Additionally it can sync SSH configuration changes back to Remmina.

sync_openssh_remmina.sh argument usage example

# Update SSH config from Remmina files 
bash convert_putty_session.sh update_ssh

# Update Remmina files from SSH config
bash convert_putty_session.sh update_remmina 
sync_openssh_remmina.shView rawView file on GitLab