Skip to content

Bash on Ubuntu on Windows – Everything I never knew I needed.

While trying to compile a Linux application on a VPS, I was quickly fed up with resource limitation, disconnects and the overall feeling of being far away. I knew there had to be a better way than creating a virtual machine or renting a virtual server to compile these applications on Ubuntu – for Windows.  Apparently, Windows 10 introduced Bash on Ubuntu on Windows.  A Linux subsystem for native command line integration of Bash in Windows 10. The install process was pretty easy:

  1. Open Settings.
  2. Click on Update & security.
  3. Click on For Developers.
  4. Under “Use developer features”, select the Developer mode option to setup the environment to install Bash.
  5. A warning will pop up; On the message box, click Yes to turn on developer mode.
  6. Sometimes after the necessary components install, you’ll need to restart your computer. I did not have to.
  7. Once your computer reboots, open Control Panel.
  8. Click on Programs.
  9. Click on Turn Windows features on or off.
  10. Check the Windows Subsystem for Linux (beta) option.
  11. Click OK.
  12. Again, you may have to restart your computer here, mine did not prompt for reboot.

Next we will set up Bash on Ubuntu on Windows

  1. From here you can open the start menu, open command prompt and type bash.
  2. Type y and press Enter to download and install Bash from the Windows Store.
  3. Then you’ll need to create a default UNIX user account. This account doesn’t have to be the same as your Windows account. Enter the username in the required field and press Enter (you can’t use the username “admin” or “root”).
  4. Input and verify the password you would like to use for the account.

You can now use the command prompt to open bash sessions. I personally use MobaXterm for all of my linux/VNC needs, so I needed to be able to SSH locally to my Bash sessions. To do this, I needed to set up an OpenSSH server on my computer.

 

  1. I first started by uninstalling openssh-server: sudo apt-get remove openssh-server
  2. I then reinstalled it:sudo apt-get install openssh-server
  3. From there I made some changes to the ssh config file:sudo nano /etc/ssh/sshd_config and disallowed root login by setting PermitRootLogin no
  4. Then add a line beneath it that says:AllowUsers yourusernameand make sure PasswordAuthentication is set to yes if you want to login using a password.
  5. Disable privilege separation by adding/modifying : UsePrivilegeSeparation no
  6. Then restart the SSH server service:sudo service ssh --full-restart

Full native Windows Explorer browsing can be used on the file system by navigating to “%localappdata%\Lxss\rootfs”

To navigate the windows file system from within bash, cd to /mnt/c

For more information and learning resources regarding BOUOW, go here:https://msdn.microsoft.com/en-us/commandline/wsl/about

Otherwise, any Ubuntu 16.04 documentation can be used to troubleshoot and find information on the bash commands and uses itself.

 

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*