PuTTY
Technology
Network Tools
Computer Tips
Software Tutorials

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 KeyContents
HKCU\Software\SimonTatham\PuTTY\SessionsAll saved session configurations (hostnames, ports, key paths, colors, etc.)
HKCU\Software\SimonTatham\PuTTY\SshHostKeysCached SSH host key fingerprints
HKCU\Software\SimonTatham\PuTTYThe 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:

  1. Press Win + R, type regedit, press Enter
  2. Navigate to HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions
  3. Right-click the Sessions folder and select Export
  4. 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:

  1. Transfer the .reg file to the target machine
  2. Double-click the .reg file
  3. Confirm the prompt to merge the data into the registry
  4. 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:

cmd
1:: Export sessions only
2reg export "HKCU\Software\SimonTatham\PuTTY\Sessions" putty-sessions.reg /y
3
4:: Export everything (sessions + host keys + defaults)
5reg export "HKCU\Software\SimonTatham\PuTTY" putty-all.reg /y

Import on the target machine:

cmd
:: Import silently
reg import putty-sessions.reg

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:

powershell
1# Export all PuTTY sessions to a .reg file
2$registryPath = "HKCU:\Software\SimonTatham\PuTTY\Sessions"
3$exportPath = "$env:USERPROFILE\Desktop\putty-sessions.reg"
4
5reg export "HKCU\Software\SimonTatham\PuTTY\Sessions" $exportPath /y
6Write-Host "Exported to $exportPath"

To list all session names before exporting:

powershell
1# List all saved session names
2$sessions = Get-ChildItem "HKCU:\Software\SimonTatham\PuTTY\Sessions"
3foreach ($session in $sessions) {
4    $name = [System.Uri]::UnescapeDataString($session.PSChildName)
5    Write-Host $name
6}

To export specific sessions selectively:

powershell
1# Export only sessions matching a pattern
2$pattern = "prod*"
3$sessions = Get-ChildItem "HKCU:\Software\SimonTatham\PuTTY\Sessions" |
4    Where-Object { [System.Uri]::UnescapeDataString($_.PSChildName) -like $pattern }
5
6foreach ($session in $sessions) {
7    $name = $session.PSChildName
8    $path = "HKCU\Software\SimonTatham\PuTTY\Sessions\$name"
9    reg export $path "$env:USERPROFILE\Desktop\putty-$name.reg" /y
10    Write-Host "Exported: $([System.Uri]::UnescapeDataString($name))"
11}

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:

 
1Windows Registry Editor Version 5.00
2
3[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\MyServer]
4"HostName"="192.168.1.100"
5"PortNumber"=dword:00000016
6"Protocol"="ssh"
7"UserName"="admin"
8"PublicKeyFile"="C:\\Users\\admin\\.ssh\\id_rsa.ppk"

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:

powershell
# Replace old IP range with new one in the .reg file
(Get-Content putty-sessions.reg) -replace '10\.0\.0\.', '172.16.0.' |
    Set-Content putty-sessions-updated.reg

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.

cmd
:: Export host keys separately
reg export "HKCU\Software\SimonTatham\PuTTY\SshHostKeys" putty-hostkeys.reg /y

The host key entries look like this in the registry:

 
"rsa2@22:192.168.1.100"="0x23,0xab3f..."

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\
  MyServer.ktx
  ProductionDB.ktx

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 TypeStored in .reg FileRisk Level
Hostnames / IP addressesYesMedium (reveals infrastructure)
Port numbersYesLow
UsernamesYesMedium
Private key file pathsYes (path only, not the key)Low
Proxy settingsYesMedium (may include proxy credentials)
PasswordsNo (PuTTY does not save passwords)N/A

Best practices for secure transfer:

  • Transfer .reg files over encrypted channels (SCP, SFTP, encrypted email)
  • Delete .reg files from intermediate storage after import
  • Review the .reg file contents before importing on shared or managed machines
  • Never commit .reg files 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 PuTTY key 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 .reg file 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 .reg file 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 .ppk key files at paths like C:\Users\olduser\.ssh\key.ppk, those paths will not exist on the new machine. Edit the .reg file to update paths before importing.
  • Running regedit without admin rights. HKEY_CURRENT_USER does not require admin rights, but some corporate environments restrict registry editor access. Use the reg command-line tool as a fallback.

Summary

  • PuTTY sessions are stored in the Windows Registry at HKCU\Software\SimonTatham\PuTTY\Sessions.
  • Export using regedit (GUI) or reg export (command line) to produce a .reg file.
  • Import by double-clicking the .reg file or running reg import from the command line.
  • Export the parent PuTTY key to include host keys and default settings alongside sessions.
  • Use PowerShell for selective export, bulk modifications, or integration with deployment scripts.
  • Review .reg file contents before importing, especially for private key paths and proxy settings that may need updating for the target machine.

Course illustration
Course illustration

All Rights Reserved.