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

Uploaded Python 3

File details

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

File metadata

  • Download URL: putty_export-0.1.1.tar.gz
  • Upload date:
  • Size: 12.5 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.1.tar.gz
Algorithm Hash digest
SHA256 fe7ac5905d076589f20abdcfef9afc27aeb2321ca0bfbc925a94e07a5c029ab9
MD5 7a0ee284d744ece6dd84c6d4326430fd
BLAKE2b-256 32ab30aec2d801dc798af2373176328582564789d0b15bf634d792f008396a17

See more details on using hashes here.

File details

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

File metadata

  • Download URL: putty_export-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e8f0a23440659cb58df441839463781942107a9ea6e496fb2da4fe3240ec877
MD5 4b78e21c1b061bf24d54341f26c44299
BLAKE2b-256 79cdc7ddd86b54dfbc4e3ea21a5125a84708f35db0cd5c610cac173596c1bcc8

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