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.3.tar.gz (12.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.3-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: putty_export-0.1.3.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for putty_export-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9f1ed58177e2e0cd91037f169d2a0f3c83ccf6a3b446224936b8a1656298c209
MD5 2ce4ad7a69bc97623e531348561bf34e
BLAKE2b-256 d45a275f3b6edba4d59a542674ea20c9acee3133b67d00a55af8c6786029783f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: putty_export-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for putty_export-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a1ff37b5840ae8f90b1110c534983cb3297f3ffa630848075ad2b0701a6cbc41
MD5 84f29ab8e280857b69caeda3a398a8a9
BLAKE2b-256 b59f1357f57ef22bfd6e30edd3ddf124e0a7191132acd05f631d5aee7225110c

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