SSH to a Linux host from Windows 10

The Windows 10 Anniversary update included a new beta feature - the Windows Subsystem for Linux. This enables us to run Linux software such as SSH natively on Windows.

To use this feature, you'll need to:

  1. Install the Windows 10 Anniversary if you don't already have it.
  2. Enable the Windows Subsystem for Linux.

What is SSH?

Secure Shell (SSH) is a protocol for secure remote login and other secure network services over an insecure network. It's most commonly used to securely connect to remote Unix like operating system.

Generate an SSH key

First open a command prompt and start a Bash session:


Next run this command to generate an SSH key:

ssh-keygen -t rsa  

Press enter to save the key in the default location and enter a passphrase for your key when prompted.

In Bash, your key will be saved to /home/{username}/.ssh (also known as ~/.ssh) and in Windows %LOCALAPPDATA%\lxss\home\{username}\.ssh.

Be sure not to change any files under %LOCALAPPDATA%\lxss in Windows or you risk corrupting your Linux system.

The public key is in the file called and the private key in id_rsa.

Copy the key to a remote machine

Now that we have an SSH key, it needs to be copied to a remote machine so that we can use it to authenticate instead of a password.

To do this, enter the following in a Bash session:

ssh-copy-id {username}@{host}  

Where username is your username on the remote machine and host is the IP address or host name of your remote machine. For example:

ssh-copy-id [email protected]  

Connect using the SSH key

To connect to the remote machine using the SSH key, from a bash session simply enter:

ssh {username}@{host}  

For example:

ssh [email protected]  

And you'll be connected and authenticated using your SSH key instead of username and password.