Skip to content

Instantly share code, notes, and snippets.

@tavinus
Last active January 1, 2024 19:40
Show Gist options
  • Select an option

  • Save tavinus/8edbed65292d59dc23e523694236ed4e to your computer and use it in GitHub Desktop.

Select an option

Save tavinus/8edbed65292d59dc23e523694236ed4e to your computer and use it in GitHub Desktop.
Compile puttygen for linux server (withouth putty)

Getting puttygen (without putty)

We needed puttygen running on an Amazon Linux (Fedora) install that has a broken putty package on yum. It fails to install because of missing X dependencies. Honestly, I was a bit glad that it failed or it would have installed a bunch of undesired X dependencies.

Debian based distros have the advantage of having a separate package for the cli tools called putty-tools.
So if you are on Debain/Ubuntu/Mint/etc you can just

sudo apt-get install putty-tools

You may still want to compile on Debians for other reasons though.

Preparation

You will obviously need to have some development tools installed.
Things like gcc, make, auto-tools, kernel-headers, etc.
Most distros have a meta-package with the Development Tools.
If anyone knows the exact stuff needed for this, post below please.

Get source

go to working directory

           # example
cd         # go home
mkdir src  # make folder
cd src     # enter it

curl

curl -O https://the.earth.li/~sgtatham/putty/latest/putty-0.70.tar.gz

wget

wget https://the.earth.li/~sgtatham/putty/latest/putty-0.70.tar.gz

unpack

tar xvzf putty-0.70.tar.gz
cd putty-0.70

Compile puttygen only

configure and make

It may complain about missing X-related dependencies, ignore it

./configure   # complains about X stuff
make puttygen

quick test

./puttygen --version
./puttygen --help

System install

Just copy puttygen

The Makefile and the install-sh scripts do a lot of things that are not needed in this case.
I found it was easier to just copy puttygen since it is self-contained.

sudo cp puttygen /usr/local/bin/puttygen
puttygen --version

You may change the folder from /usr/local/bin to something else on your $PATH

PS: Not sure if there are other dependecies needed that I already had (eg. openSSL, etc)

Convert PPKs to PEMs

You may find this little script usefull to convert PPK certs to PEM
https://gist.github.com/tavinus/931e226aabc913c8b4b5fbd076406b92
It uses puttygen (and is in Portuguese, for now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment