Skip to main content

Export PuTTY session settings from Windows registry to OpenSSH config format

Project description

putty-export

Export PuTTY session settings from a Windows registry (.reg) file to OpenSSH ~/.ssh/config format.

Usage

# Print SSH config to stdout
putty-export putty_sessions.reg

# Write to a file
putty-export putty_sessions.reg -o ~/.ssh/config

# Include the "Default Settings" template session (normally skipped)
putty-export putty_sessions.reg --include-default-settings -o config

Exporting PuTTY sessions from Windows

  1. Open Registry Editor (regedit.exe).
  2. Navigate to HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions.
  3. Right-click Sessions and choose Export.
  4. Save as a .reg file (e.g. putty_sessions.reg) and transfer it to the machine where you run putty-export.

PuTTY → OpenSSH mapping

PuTTY (registry) OpenSSH config Notes
Session name (from key path) Host URL-decoded (e.g. %20 → space).
HostName HostName Decoded from UTF-16LE.
PortNumber Port Default 22 if missing.
UserName User Omitted if empty.
PublicKeyFile IdentityFile Path normalized to forward slashes. See Keys below.
ProxyMethod + ProxyHost/Port/Username ProxyCommand or ProxyJump See Proxy below.
PortForwardings LocalForward / RemoteForward / DynamicForward Comma-separated: Lport=host:port, Rport=host:port, Dport.
AgentFwd ForwardAgent 1 → yes (omitted when 0).
Compression Compression 1 → yes (omitted when 0).
X11Forward ForwardX11 1 → yes (omitted when 0).

Keys

  • IdentityFile is written with the path from PuTTY (backslashes converted to forward slashes). PuTTY uses .ppk keys; OpenSSH uses PEM/OpenSSH format. Convert keys with:
    puttygen key.ppk -O private-openssh -o ~/.ssh/key_openssh
    
    Then point IdentityFile at the converted file, or replace the path in the generated config.

Proxy

  • ProxyMethod 0 = none (no directive). 1 = SOCKS → ProxyCommand nc -x host:port %h %p. 2 = HTTP CONNECT → ProxyCommand connect -H host:port %h %p. 3/4 = Telnet/Local → ProxyCommand from ProxyTelnetCommand. 5 = SSH proxy → ProxyJump user@host.
  • ProxyPassword is not stored in SSH config. Use key-based auth or other means for proxy/jump host authentication.

Requirements

  • Python 3.8+
  • No external dependencies (stdlib only).

Installation

pip install -e .

Development

Run tests:

python -m unittest discover -s tests -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

putty_export-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

putty_export-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file putty_export-0.1.0.tar.gz.

File metadata

  • Download URL: putty_export-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for putty_export-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0eb65d3e818fedffcf43950808b5de70e861ca8f89691cf6653a9d10b1912971
MD5 147d81fd12de14e89e255af770691d1c
BLAKE2b-256 0493b4a950007d49dbc0a5516fce62744d6f3b256e4635036324b5e5e16f098e

See more details on using hashes here.

File details

Details for the file putty_export-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: putty_export-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for putty_export-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b29e3e0edadea63cce9ded6e80990cbffbc34d6dc74fa22336635134ac85d9c
MD5 29986abbe0852853f7cb83839c0e99b8
BLAKE2b-256 1f8713a0cd488dbaacab9a81a1d0c53b48f21e3eb2ac3169f1d24d44a27c8324

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page