SSH using PuTTY.exe into a vagrant managed kohadevbox VirtualBox VM on Win 10 Prof

Steps to set up public-key based login into a vagrant managed kohadevbox VM

What is kohadevbox?

As the at says – “Create a development environment for the Koha ILS project. It uses Vagrant and Ansible to set up a VirtualBox.” Basically it automates the long and somewhat complex process of manually setting up a development system for #kohails.

Why PuTTY?

From the website – PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers. It is our go-to tool on Windows for accessing physical Koha boxes or VMs via SSH.

Vagrant sets up SSH service on the VM to use public-key authentication. Therefore our PuTTY instance needs to know the private key that Vagrant had setup inside the VM, in order to login into it. As many posts in Stackoverflow indicates, this is a point where many people get stuck. Usually they try with %USERPROFILE%\.vagrant.d\insecure_private_key and that typically fails.

Steps for kohadevbox

Using git-bash go to the directory where you had cloned kohadevbox. Be default it will be %USERPROFILE%/git/kohadevbox if you have simply followed the instructions from kohadevbox file. In our case, it was %USERPROFILE%/gitdev/kohadevbox as we had changed it.

Run the command

vagrant ssh-config

You should see something like this:

The line to note in the output is IdentityFile. That’s the private key you need to grab and feed to PuTTYGen for it to convert it into a PuTTY compatible .ppk format private key.

NOTE: This path to the key is going to be different for different users, so do not attempt to copy-paste what you see here, instead use your own IdentityFile value.

Now we convert the vagrant_private_key from IdentityFile and save it as a .ppk file.

And lastly we import it into PuTTY like this and we are good to go!

Finally we are logged in into the VM

NOTES: The versions of software used – (a) PuTTY.exe – 0.71 (b) Vagrant – 2.2.7 (c) Git Bash – 2.25.0 (d) VirtualBox – 6.1.2

Leave a Reply

Your email address will not be published. Required fields are marked *