You are here

Another approach to having a complete putty toolset

3 posts / 0 new
Last post
Last seen: 3 years 4 months ago
Joined: 2010-05-02 07:52
Another approach to having a complete putty toolset

Hey ppl...

Just wanted to share my approach on having the complete set of putty tools in a really portable way.

The principles

The whole approach is based on the following principles:

  • I want to use the original release of putty, and not any alternative - i completely agree with John on the fact that the reason we use putty is because we trust it.
  • I don't want to "hack" - I want to go with the simplest of approaches, using the platform tools - Launcher and Installer.
  • I want to have my keys with me on my usb - encryption and safety is taken care of from other applications. I want putty to be aware of my keys and use them.
  • I want to have an integrated experience from other applications that use putty, without any extra effort from either side.

Reading through the forums, there were some interesting approaches and i got a couple of ideas. After some research, I ended up with - what I think to be - a solution to my putty problems. What I did was alter John's launcher to "focus" on peageant instead of putty, making use of its command line parameters to accomplish my goals.

The launcher



The launcher ini file is modified so that it invokes a batch file instead of an executable. The WaitForExe keys ensure that the portableapp will stay active as long as any of the putty tools is running. I also use an environmental variable for the location of the key files.

The batch file

@rem Do not use "echo off" to not affect any child calls.
@setlocal enabledelayedexpansion
@set allkeys=
@for %%X in (%KeysFolder%\*.ppk) do @set allkeys=!allkeys! "%%X"
pageant %allkeys% %*

PuTTYSuitePortable.cmd takes care of enumerating the keys folder for key files, passing the paths as parameter to peagent. It also passes any existing parameters that came from the launcher itself. Using this approach, one could create shortcuts like "PuttySuitePortable.exe -c putty.exe". This will be translated in "peagent.exe {keyfiles} -c putty.exe", meaning that putty will be invoked after ensuring that peagent is running with all the available keys loaded. The same goes for any other putty tool - like plink, psftp etc.

Regarding using putty portable with other applications, I have addressed it by making the portableapp start automatically. Since peagent is running, the registry settings are in place and any execution of any of the putty tools - regardless of the location they are executed from or the program that invokes them - works like a charm. In addition, any changes made by using the tools - ie any putty sessions saved, any keys loaded etc - are properly saved and available on my next run.

I have packaged the whole approach to a separate installer. I took the official portable app, renamed it to PuttySuitePortable, made the changes and created an online installer. Be my guests and check it out - and please, do correct me where I am wrong.

Last seen: 10 years 9 months ago
Joined: 2013-02-14 14:18
works for me

I've not seen any followups, so I'll at least throw my $0.02 in that this method (pkg) is confirmed to work and would seem in principle to be a good idea.

Pageant - less so PuttyGen, Psftp, etc - is pretty critical, and past forum Pageant comments suggested this style of hack might be possible as a PuttyPortable BAT file. This pkg actually takes it out of the theoretical and puts it into a real working installer. The only downside is that the WinSCPPortable app assumes the PuttyPortable path for the link to terminal session, and not 'PuttySuitePortable'.

In the case of an installation under, how would I set the %KEYS% directory to reference a location under the TrueCrypt volume?

Last seen: 3 years 4 months ago
Joined: 2010-05-02 07:52
Glad that helps

Hey... Glad you found some use on this approach. Personally, I have been using this for a long long time now and it works fine.

Regarding the integration of WinSCP, one could make a PuttyPortable.bat file that launches putty through pagent and "compile" it to an exe - using one out of many bat-to-exe methods.

As for the Keys variable, you could change the location under the [Environment] section in launcher.ini. But I do think a more subtle approach would be to include an "override" of this on the user settings ini file - as dictated by the paf specification.

Anyways, again, glad you found that usefull. I hope John finds some time to read this and possibly give this approach some more "official" love - I cannot see any valid point of this not being the next official puttyportable version. But then, I might be missing something.

Hope I'm being usefull.

Log in or register to post comments