Windows Terminal SSH connection from KeePass

5
(1)

This tutorial shows how to deploy and use SSH from the Windows Terminal on Windows 11, using the KeePass Password Manager.

Add KeePass URL Override Scheme

In the first step with launch KeePass, a schema element for URL Override is created in KeePass, go to Tools – Options.

SSH Windows KeePass Click Tools Options

Click the Integration tab, then the URL Overrides button at the bottom.

In the URL Override window, click Add to enter a new schema.

As a scheme name I use „winterm“ here. Under URL override, insert the following line.

cmd://wt ssh "{USERNAME}@{TITLE}"

  run „wt“ to start the windows terminal emulator, then append the user name in brace and the hostname from the title field.

Confirm with OK and close KeePass and start again.

KeePass Add Entry for SSH in Windows Terminal

After our schema element winterm is created, we create a new entry with choose Add Entry, enter the hostname in Title, enter User name and Password, in the field URL insert „winterm:“ append with colon.

Start Windows Terminal SSH session

The saved entry is now available, with a double click on URL the SSH connection is started here to the Linuxmint.

SSH from Windows Terminal on Windows 11 using KeePass

Public key authentication

SSH authentication using public key in Windows Terminal launch from KeePass is not only more secure, logging in without entering a password is also easier. For this purpose, a key pair is generated on the client, the public part of the key is transferred to the server, then the server is set up for asymmetric encryption and authentication, more on this in the tutorial here or find on ssh-keygen how it works.

Under the path of the Windows user profile, create a directory „.ssh“, with dot (.), the easiest way to change to the path is to enter „%USERPROFILE%“ in the Windows Explorer address bar.

The directory for e.g. c:\users\james\.ssh, which contains the file with the private key „key-ecdsa„, as well as the file „config„.

  The known_hosts file is automatically generated by SSH as soon as a connection has been successfully authenticated for the first time. SSH add fingerprints to known_hosts to avoid Man-in-the-middle attacks.

We create the „config“ file using the Notepad Editor, paste in the following lines.

Host linuxmint
     HostName 10.10.10.10
     User james
     IdentityFile ~/.ssh/key-ecdsa
     ServerAliveInterval 60

The host name is that one we use in KeePass at Title, the user i.e. james, the key file refers with IdentityFile to the file „key-ecdsa“ under %USERPROFILE%.ssh.

  OpenSSH on Windows is a port from the OpenBSD-project (open source), on unixoid operating systems the tilde (~) character is used as a relative path to the user home directory, known on Windows as the environment variable %USERPROFILE%. A leading point in file names and directories (.ssh) applies to hidden files and directories on unixoid systems.

Wie hilfreich war dieser Beitrag?

Klicke auf die Sterne um zu bewerten!

Durchschnittliche Bewertung 5 / 5. Anzahl Bewertungen: 1

Bisher keine Bewertungen! Sei der Erste, der diesen Beitrag bewertet.

2 Gedanken zu „Windows Terminal SSH connection from KeePass“

  1. Hello,

    Very interesting article.

    If I try to follow the same steps (login with username and password), the terminal prompt me for password. And I am not sure how I can give it to the promnt in automatic way.
    On the video you were able to login without any issue.
    I am wondering in the first part of article (when you are login to linuxmind), did you login only with username and password, or you were using ssh key?

    1. it is most likely due to the ssh server setting and the public key, try run the connection in cmd with ssh -vvv user@host, the hostname must match the one in the ~/.ssh/config file, check also the public key on the remote host under ~/.ssh/authorized_keys

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert