Quick Tip: Exporting PuTTY Sessions
By Andrius Miasnikovas
Here’s a really quick tip. If you’re running Windows and are using PuTTY to manage your unix servers, chances are you have a lot of saved sessions i.e. information on how to connect to your server, what font type and size to use, etc. And if you ever tried copying them to another machine you noticed that PuTTY doesn’t have a user-friendly export/import sessions button. But there’s a way to perform a saved sessions export manually. PuTTY keeps all session related information in system registry, so what you can do is export that part of the registry tree to a file with the following command:
regedit /ea sessions.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
The line above will create a sessions.reg file which you can copy to a machine where you want to import your saved sessions and simply double click it. Windows will ask you if you’re sure you want to run it, since you’re actually modifying the system registry, so click Yes and voilà. You can run PuTTY and start using it the way you’re used to. One thing to note is that if you were using private/public key authentication (passwordless logins) for some servers then you need to copy over your private keys to the new machine as well. And remember to place them so that they can be found using the same path as on the old machine. If in doubt, just open sessions.reg with any text editor and browse trough it looking for lines like the following, then you’ll know what files you need to copy and where to put them.
"PublicKeyFile"="C:\\var\\keys\\key1.ppk"
Another use for this session export could be when you want to change something like a font on all your saved sessions, but when you have a lot of them, then it becomes a time consuming process. What you could do is export your sessions as shown before, then open the file in a text editor and simply do a mass replace for the setting that you want changed. For example you could change this line
"Font"="Courier New"
to this line
"Font"="Lucida Console"
Then just re-import your sessions by double clicking the file. It will overwrite your current session information. That’s it.