How to export/import PuTTY sessions list?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
PuTTY stores all session configurations in the Windows Registry under HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions, not in a portable file. To export sessions, you use regedit or reg export to save this registry key to a .reg file. To import on another machine, you merge that .reg file back into the registry. This article covers the GUI method, command-line automation, PowerShell scripting, and important security considerations for transferring session data.
Where PuTTY Stores Sessions
Unlike most modern applications that use configuration files, PuTTY stores everything in the Windows Registry. The relevant keys are:
| Registry Key | Contents |
HKCU\Software\SimonTatham\PuTTY\Sessions | All saved session configurations (hostnames, ports, key paths, colors, etc.) |
HKCU\Software\SimonTatham\PuTTY\SshHostKeys | Cached SSH host key fingerprints |
HKCU\Software\SimonTatham\PuTTY | The parent key (includes default settings and all subkeys) |
Session names in the registry are URL-encoded. A session named "Production DB" appears as Production%20DB in the registry tree.
Method 1: Export via Registry Editor (GUI)
This is the simplest approach for a one-time migration.
Export steps:
- Press
Win + R, typeregedit, press Enter - Navigate to
HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions - Right-click the
Sessionsfolder and select Export - Choose a location and save as
putty-sessions.reg
To export everything (sessions, host keys, and default settings), export the parent key HKEY_CURRENT_USER\Software\SimonTatham\PuTTY instead.
Import steps:
- Transfer the
.regfile to the target machine - Double-click the
.regfile - Confirm the prompt to merge the data into the registry
- Open PuTTY and verify the sessions appear in the saved sessions list
Method 2: Export via Command Line (reg export)
The reg command is faster and scriptable:
Import on the target machine:
The /y flag on export overwrites the file without prompting. The import command has no equivalent silent flag; it always writes to the registry directly.
Method 3: PowerShell Automation
For bulk operations or integration with deployment scripts, PowerShell provides more control:
To list all session names before exporting:
To export specific sessions selectively:
Method 4: Direct Registry File Editing
The exported .reg file is a plain text file that you can edit with any text editor. This is useful for bulk modifications before importing:
You can modify hostnames, ports, or key paths in the text file before importing. This is particularly useful when migrating sessions between environments where IP addresses or paths differ:
Backing Up SSH Host Keys
When migrating PuTTY sessions, you usually want the cached SSH host keys as well. Without them, PuTTY will prompt you to verify each server's fingerprint again on the new machine.
The host key entries look like this in the registry:
Each key is identified by the algorithm, port, and hostname. If you change server IPs during migration, these entries will not match and PuTTY will prompt for re-verification regardless.
Alternative: Use KiTTY for File-Based Storage
If you need portable session storage without registry dependency, consider KiTTY, a fork of PuTTY that supports file-based session storage:
KiTTY sessions are plain text files stored alongside the executable, making them trivially portable via USB, cloud sync, or version control.
Security Considerations
PuTTY session files contain potentially sensitive information:
| Data Type | Stored in .reg File | Risk Level |
| Hostnames / IP addresses | Yes | Medium (reveals infrastructure) |
| Port numbers | Yes | Low |
| Usernames | Yes | Medium |
| Private key file paths | Yes (path only, not the key) | Low |
| Proxy settings | Yes | Medium (may include proxy credentials) |
| Passwords | No (PuTTY does not save passwords) | N/A |
Best practices for secure transfer:
- Transfer
.regfiles over encrypted channels (SCP, SFTP, encrypted email) - Delete
.regfiles from intermediate storage after import - Review the
.regfile contents before importing on shared or managed machines - Never commit
.regfiles to version control repositories
Common Pitfalls
- Exporting only Sessions, not SshHostKeys. Without the host keys, every server connection on the new machine triggers a fingerprint verification prompt. Export the parent
PuTTYkey to get everything at once. - URL-encoded session names. Session names with spaces or special characters are stored URL-encoded (e.g.,
My%20Server). Searching for "My Server" in the registry requires understanding this encoding. - Windows version differences. Registry structure is consistent across Windows versions for PuTTY, but merging a
.regfile from a newer Windows version into an older one may include registry entries that the older PuTTY version ignores (harmless but cluttering). - Forgetting to back up before importing. If the target machine already has PuTTY sessions, importing a
.regfile overwrites any sessions with the same names. Back up the target's sessions first. - Private key paths breaking on the new machine. If your sessions reference
.ppkkey files at paths likeC:\Users\olduser\.ssh\key.ppk, those paths will not exist on the new machine. Edit the.regfile to update paths before importing. - Running regedit without admin rights.
HKEY_CURRENT_USERdoes not require admin rights, but some corporate environments restrict registry editor access. Use theregcommand-line tool as a fallback.
Summary
- PuTTY sessions are stored in the Windows Registry at
HKCU\Software\SimonTatham\PuTTY\Sessions. - Export using
regedit(GUI) orreg export(command line) to produce a.regfile. - Import by double-clicking the
.regfile or runningreg importfrom the command line. - Export the parent
PuTTYkey to include host keys and default settings alongside sessions. - Use PowerShell for selective export, bulk modifications, or integration with deployment scripts.
- Review
.regfile contents before importing, especially for private key paths and proxy settings that may need updating for the target machine.

