How to SSH into the BASH Ubuntu instance built into Windows 10

If you have Windows 10 Anniversary Edition, you’re probably aware that you can run a complete Linux instance inside of Windows 10.

But wouldn’t it be cool if you could open a SSH session to the BASH shell from PuTTy running on your Windows 10 host?

1. Install PuTTy

The first thing we need to do is to get PuTTy on our Windows 10 host.  If you already have it you’re good – if not grab it from the official PuTTy site:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

fixedbyvonnie_install_putty_3

2. Enable BASH on Windows 10

Mash the Windows Key, type “developer” and then click Developer Mode under Use developer features in the right pane of the Settings window.

fixedbyvonnie_enable_developer_mode_1

You’ll be asked to reboot.  When you come back, hit the Windows Key again and type “Turn Windows features on or off” then scroll down to “Windows Subsystem for Linux (Beta)”, click OK wait for the installation to finish (takes about 5 minutes) and then you’ll reboot again.

fixedbyvonnie_install_the_windows_subsystem_0

Okay, now we’re ready to go

Press the Windows Key + r and type “bash” to load the BASH shell.  We need to set it up.

The command prompt will ask you to download Ubuntu from the Windows Store.  Hit “y” to continue, let it download (took me about 15 minutes to download) and then you’ll create your UNIX username (which is distinct from your Windows username) and your password for that Linux account.

fixedbyvonnie_bash_installed_2

Now we need to install openssh.

I typed clear to clear the screen and then:

sudo apt-get install openssh-server

fixedbyvonnie_install_openssh-server

 

Now let’s configure the sshd_config file so we can make this baby work.

Type:

sudo vi /etc/ssh/sshd_config

Type the forward slash key and then enter:

PermitRootLogin without-password

fixedbyvonnie_ssh_permitrootlogin_no

 

Now press “i” to enter the edit mode and change it to:

PermitRootLogin no

Press escape to leave edit mode

then press the forward slash again and enter:

PasswordAuthentication

We need to change this to yes

Do the same thing to change UsePriviledgeSeperation to no

fixedbyvonnie-use_privilegeseparation_no

Now press Escape and hit capital g:

G

to jump to the bottom of the file and then press

i

to enter insert mode again.  We need to add a line:

AllowUsers vhudson

 

Swap out vhudson with the username you created when you installed Bash.

Press Escape to enter command mode..

Hit ZZ to save the file and close and then bounce the SSH service.

sudo service ssh --full-restart

connect to 127.0.0.1 using PuTTY and you should be in!

fixedbyvonnie_using_putty_to_connect_to_windows_10_bash

Now just login with your UNIX creds

fixedbyvonnie-using_putty_to_connect_to_bash_in_windows_10_2

About

Connect with Vonnie on Twitter

Posted in Windows, Windows 10 Tagged with: