Best ssh setup for windows

I’ve tried quite a few different setups for administering my various linux boxen from Windows, and this is currently my favourite: Mintty for WSL (aka WSLtty).

Here’s how to set it up.

Install Windows Subsystem for Linux (WSL):

  1. Open Powershell as an administrator
  2. Enter this command:
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  3. When it’s done, restart your computer.

Install Linux (on WSL)

I recommend Debian – it’s well supported by the community, and a pretty lightweight install compared to some of the other choices.

For the local windows store

  1. Open the Windows Store
  2. Search for “Debian”
  3. Click on Get
  4. Click on Install

Once it’s installed:

  1. Find and click on the Debian app in your start menu
  2. Wait for a moment, then set up a username for this local installation of linux. It’ll be slightly more convenient if you use the same username you have on your remote linux machines.
  3. Exit the terminal: type:
    exit
    and press enter.

This info came from https://docs.microsoft.com/en-us/windows/wsl/install-win10

Install WSLtty

  1. Go to https://github.com/mintty/wsltty/releases/latest
  2. Choose the right release for your system – unless you have a fairly old computer it’ll be the one ending in “x86_64.exe”
  3. Download and install.
  4. This app isn’t digitally signed in a way approved by Microsoft, so a warning will pop up (“Windows protected your PC”). Click More info then Run anyway.

Run and connect!

Mintty should have installed a shortcut called “WSL Terminal” with the linux penguin icon, click on it and you’ll get a black terminal windows with prompt in the top left: [your unix username]@[computer name]:~$

Let’s get your local linux system up to date:

  1. Type sudo apt update then press enter.
  2. Type in your local linux password (that you created earlier)
  3. sudo apt upgrade, then press y and enter when asked if you want to continue
  4. It may take a little while, depending on the speed of your pc and internet connection.
  5. Finally lets install ssh:
    sudo apt install ssh

Now we can connect to a remote linux computer:

If the username on the remote computer is the same as the one you created earlier, the command is:
ssh remotelinuxcomputer.example.com or ssh 192.168.2.1, when you put in the computer’s name or ip address.

If the username is different, no problem, do this:
ssh joebloggs@remotelinuxcomputer.example.com
or
ssh joebloggs@192.168.2.1

In either case, you will probably get a warning about “the authenticity of the host xxxxx can’t be established”. Don’t worry, just type yes, then enter you password for the remote computer, and you’re in!

One final tip

If ssh into remote computers is all your do with this, then log out, the login command will be remembered by the shell, even if you reboot.
Next time you open the WSL terminal, press the “Up” as many times as you need to scroll through the command history and find the one you wanted.

Leave a Reply

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