How to use a new Windows Terminal app for SSH?

If you want to connect to a machine on Google Compute Engine using Windows Terminal, you can write a script to replace the default command and use ssh instead of putty.exe. More details here.


You can use a commandline field in your profile configuration to initiate an SSH connection on tab creation.

Step-by-step guide:

  1. Ensure you have an SSH client (try to connect to the server from a Command Prompt tab). @dhgouveia2's post details this step.
  2. Open Settings (Ctrl+,)
  3. Find the "list" array in the "profiles" object
  4. Find a Command Prompt profile ("commandline": "cmd.exe")
  5. Duplicate the profile (copy-paste the whole object, watch for the comma between objects)
  6. Change the "guid" value to a new GUID (for example, from here)
  7. Change the commandline value to "commandline" : "ssh me@my-server -p 22 -i ~/.ssh/id_rsa" (use your own connection command).
  8. Change the profile's "name"
  9. Add an "icon" : "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png" item to use a Tux icon (default icons are here)
  10. You should have something like this:
    {
        "$schema": "https://aka.ms/terminal-profiles-schema",
        "profiles":
        {
            "list":
            [
                // ...
                {
                    "guid": "{1d43c510-93e8-4960-a18b-e432641e0930}",
                    "name": "ssh my-server",
                    "icon" : "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
                    "commandline": "ssh me@my-server -p 22 -i ~/.ssh/id_rsa"
                }
            ]
        }
    }
    
  11. Save the configuration and enjoy the new item in the New Tab drop-down.

If you want to stay in the terminal and easily manage all your ssh connections inside WSL then i would recommend using the built in ssh config management in the ssh command.

Basically you put all your different ssh configurations in to the file ~/.ssh/config

There is a good post documenting the basic use of this here

Hope this helps.


You can use native ssh client from Windows 10,

From powershell

Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

# This should return the following output:

Name  : OpenSSH.Client~~~~0.0.1.0
State : NotPresent
Name  : OpenSSH.Server~~~~0.0.1.0
State : NotPresent

Install the OpenSSH Client

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

It should return the following output:

Path          :
Online        : True
RestartNeeded : False

Uninstall the OpenSSH Client

Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

Add the hosts to your ssh config file

From your home folder, go to the .ssh/config file, the folder may not exist if the ssh application has not been used, so it will be necessary to create it on you home folder

C:\Users\%USERPROFILE%\.ssh

@Damo post a very good documentation about the ssh config.

e.g config

Host test
    User test
    HostName 127.0.0.1
    Port 22
    IdentityFile ~/.ssh/id_rsa

Windows Terminal

Similar to the @Himura instructions, but instead of using "bash.exe" you will using "ssh.exe".

For connection to the remote host, you can use the hostname from the.ssh/config file e.g ssh.exe test, if you don't want to use a config file, you can use the user@ip ssh.exe [email protected] and the password dialog will be promt

  • Edit your profile.json from the settings on Windows Terminal,
  • Duplicate a profile
  • Change the "guid" value to a new GUID
  • Change the commandline value with ssh.exe, e.g "commandline" : "ssh.exe test"
  • Change the profile's "name"

e.g

C:\Users\%USERPROFILE%\.ssh\config

Host vagrant
    Hostname 127.0.0.1
    Port 2222
    User vagrant
    IdentityFile ~/.ssh/vagrant.key

profile.json

    ...
    {
        "acrylicOpacity" : 0.75,
        "closeOnExit" : true,
        "colorScheme" : "One Half Dark",
        "commandline" : "ssh.exe vagrant",
        "cursorColor" : "#FFFFFF",
        "cursorShape" : "bar",
        "fontFace" : "DejaVu Sans Mono for Powerline",
        "fontSize" : 10,
        "guid" : "{1777cdf0-b2c4-5a63-a204-1111f349ea7c}",
        "historySize" : 9001,
        "icon" : "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
        "name" : "Vagrant",
        "padding" : "0, 0, 0, 0",
        "snapOnInput" : true,
        "startingDirectory" : "%USERPROFILE%",
        "useAcrylic" : true
  }
  ....

If you want to set the new entry as default, search for the defaultProfile key

....
   "globals" : 
    {
        "alwaysShowTabs" : true,
        "copyOnSelect" : false,
        "defaultProfile" : "{1777cdf0-b2c4-5a63-a204-1111f349ea7c}",
        "initialCols" : 120,
        "initialRows" : 30,
....