HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions
.
If you want to view the SSH tunnels configured for a particular host, i.e.,
the port forwarding
settings for that host, you can navigate to
HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\SessionName\PortForwardings
where SessionName is the name you have given to the session
associated with the host. E.g., suppose you regularly establish an
SSH
connection to www.example.com and have named a session for that site
MySite
. You could navigate to
HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\MySite\PortForwardings
to find the port forwardings settings. If you had named the session
My Site
, there would be a %20
in the session name
stored in the registry as %20
is an HTML representation for the
space character. You can doubleclick on the PortForwardings
key
in the right pane of the registry window to see the values stored in the key.
You might see something like the following:
L22011=192.168.0.11:22,L33018=192.168.0.18:33018
The above value indicates that, when you establish a session to the host
www.example.com, port forwarding is set up so that port 22011 is set on the
local system, i.e., the system from which you are connecting, to be forwarded
to the SSH port 22 on another host at IP address 192.168.0.11. So if you
establish an SSH session to www.example.com, you can subsequently establish
another SSH session to 127.0.0.1 on port 22011 on the local system, from which
you established the first SSH session, to connect to port 22 on the system at
192.168.0.11. Likewise, if the system at 192.168.0.18 is listening on port
33018 for a connection, you can connect to 127.0.0.1:33018, i.e., port 33018 on
the localhost address
(127.0.0.1), which will be forwarded to the same port on 192.168.0.18. The
local and remote port numbers don't have to be the system. E.g., if you
wished to establish a
Remote Desktop
Protocol (RDP) port on 192.168.0.18, you could change the port forwardings
in PuTTY to list the remote port as 3389 or you could edit the entry in the
registry by right-clicking on PortForwardings
and choosing
Modify and then changing the L33018=192.168.0.18:33018
to
L33018=192.168.0.18:3389
.
If you wish to transfer all of the settings for a session, including the
PortForwardings
, you can right-click on the session name in
the left pane of the window registry and choose File and
Export from the Registry Editor window. You can then save the
session settings as a registry file with a .reg file extension. If you
only want to save the port forwarding settings, e.g., to transfer to another
system or user, you could edit the .reg file with the
Windows Notepad
editor by right-clicking on the file and choosing Open with and then
Notepad. You could then delete all of the lines in the file that
appeared after
[HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\MySite]
but
the one pertaining to port forwarding, i.e.,
L22011=192.168.0.11:22,L33018=192.168.0.18:33018
. The file would
then contain only the following lines:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\MySite]
"PortForwardings"="L22011=192.168.0.11:22,L33018=192.168.0.18:33018"
If you then saved the file, you could transfer it to another computer
or user account on the same system and double-click on it to have the port
forwarding settings added to the registry, if there was already a session
named MySite
in the registry for the user for which you wished
to import the settings. If there wasn't such a session for the destination
account, then don't remove any lines from the registry file, e.g.,
MySite.reg
, but simply transfer the file to the destination
account and double-click on it to enter all of the settings for the session
into the registry. When you double-click on the file to add the information
within it to the Windows Registry, you will see a warning message that
"Adding information can unintentionally change or delete values and
cause components to stop working correctly." You will be prompted "Are
you sure you want to continue?" Click on the Yes button. You should
then see another window open informing you that the keys and values
contained in the file have been successfully added to the registry.
If you just wish to view the port forwarding sessions, you can do so by navigating to the relevant spot in the registry or you can query the registry from a command line interface (CLI) by opening a command prompt window and issuing a reg query command. E.g.:
C:\>reg query HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\MySite /v PortForwardings HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\ACI PortForwardings REG_SZ L22011=192.168.0.11:22,L33018=192.168.0.18:33018 C:\>
If you wished to view all of the settings for a session, you could use the
command reg query
HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\MySite
, instead.
If you wished to transfer the settings for all sessions somewhere else,
you could right click on Sessions
under
HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions
and choose
Export or choose File and Export... from the
Windows Registry Editor and then double-click on the .reg file you create
while logged in under a different account to transfer the settings to that
other account. Or you could do the same thing for
HKEY_CURRENT_USER\SOFTWARE\SimonTatham
to transfer all of the
PuTTY information, including the Jumplist
values. The Jumplist contains a list of recent sessions.
Related: