Never Type Your Password Again: Automatic SSH Logins in Windows Terminal

Overview

Requirement

Procedures

  1. Generate key

    1. Execute ssh-keygen and generate the file id_rsa

      1C:\Users\dennys>ssh-keygen
      2Generating public/private rsa key pair.
      3Enter file in which to save the key (C:\Users\dennys/.ssh/id_rsa):
      
    2. The content of id_rsa is like the following.

      1ssh-rsa AAAAB******************== dennys@mypc123
      
  2. Put the key on Linux

    1. Open the file ~/.ssh/authorized_keys and paste the content of id_rsa into it.
  3. Test automatically login

    1. Execute ssh name@host, you don't need to input password any more.
  4. Configuratino Windows Terminal

    1. Open settings.json of Windows Terminal.

      1. Click Windows Terminal -> Settings -> Open JSON file

      2. Add a new profile in settings.json

         1    "profiles":
         2    {
         3        "defaults": {},
         4        "list":
         5        [
         6            {
         7                "name": "ssh linux100",
         8                "commandline": "ssh dennys@192.168.1.100",
         9                "tabTitle": "This is a tab title",
        10                "hidden": false
        11            },
        12        ]
        13    }
        
      3. Test the new profile, when you click it, Windows Terminal should open a new tab and login automatically.