Wednesday, May 9, 2018

Keepass and Cygwin's ssh

Since having Cygwin installed anf fully operational, I've let go of PuTTY a long time back.

But Keepass keeps the default ssh:// handler dependent on PuTTY.
Here is how to change it, and use Cygwin's plain old 'ssh' com MinTTY terminal.

On Keepass, Tools > Options > Integration, click 'URL Overrides' on the bottom right.



Untick the default ssh handler.

Next, create a new entry, with:

Scheme: ssh
URL override:
cmd://C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -h error -e /usr/bin/bash -l -- ssh -l {USERNAME} -p {BASE:PORT} {BASE:HOST}
(adjust paths accordingly)

This has one caveat, where you need to always define the port number on the URL field, and not leave it blank...

example: ssh://host.name:22

One option is to create a wrapper for ssh, so it can handle URL formatted arguments (protocol://username@hostname:port), split it accordingly, and handle all the possible omissions.... but that's for another post....