Emil Fihlman -1. Mirror // Not available 0. Files https://emil.fi/d/bashwin/ 1. Preamble Microsoft, if you are reading this: Please get your shit together and provide a proper solution. You don't want this kludge to spread. 2. Header This guide will detail how to have the Windows Subsystem for Linux (WSL), which is more like _just_ Bash, "appear" as a background service on Windows (instead of having a dedicated window open all the time), allowing an user to open and close terminals without fear of shutting the subsystem down. This also allows users to ssh into the subsystem with their terminal program of choice, extending usability further. In short: you get an actually usable subsystem but this implementation is bad. No I mean it really is kludge and it really is a mvp. If you have improvements, please do share them with me on IRC, Emil@IRCNet/Freenode or elsewhere and I'll update this guide. To get WSL, follow this guide and details: https://msdn.microsoft.com/fi-fi/commandline/wsl/install_guide To uninstall or upgrade WSL, on the Windows commandline do lxrun It will prompt you for the correct settings. 3. Payload By default to have the subsystem running, you need to have a bash window open somewhere. This is bullshit but mandatory. If you are okay with having a visible window all the time, simply doing start /MIN bash.exe exit from the Windows commandline or from a .bat file will work. You can also play around with the /B option. A better solution exists, fortunately. Save the following to C:\wslbash.vbs Dim WinScriptHost Set WinScriptHost = CreateObject("WScript.Shell") WinScriptHost.Run Chr(34) & "bash.exe" & Chr(34), 0 Set WinScriptHost = Nothing https://emil.fi/bashwin/wslbash.vbs Executed, it starts a hidden commandline with bash.exe. To have it executed on startup, do shell:startup from the run-prompt (CTRL+R) and add a shortcut to the .vbs file to the folder. Also add the program to the start menu by making a shortcut to it to C:\ProgramData\Microsoft\Windows\Start Menu\Programs Bash should now launch on startup and you can start it to background from the .vbs script if you need to and using the normal Bash launcher you can just launch normal terminals. Linux side we don't have any services starting so we need to "fix" this. Here's a quick script that should do the required https://emil.fi/bashwin/bashwininstall.sh Manually, on your now running WSL Bash do sudo mkdir /etc/startup/ Save the following to /etc/startup/serviceinit.sh #!/bin/bash SERV="/etc/startup/serviceinit.sh daemon" LIST="$(ps aux)" COUNT=$(grep -o "$SERV" <<< "$LIST" | wc -l) if [ "$COUNT" -eq "0" ] then ${SERV} & echo "Starting services" /etc/startup/servicelist.sh elif [ "$1" == "daemon" ] then sleep infinity fi Save the following into /etc/startup/servicelist.sh #!/bin/bash service ssh start service cron start Then do the following sudo chmod 744 /etc/startup/serviceinit.sh sudo chmod 744 /etc/startup/servicelist.sh echo "sudo /etc/startup/serviceinit.sh" >> /home/$USER/.bashrc sudo visudo At the end add yourusername ALL=(root) NOPASSWD: /etc/startup/serviceinit.sh You can now add services and programs to run on startup to /etc/startup/servicelist.sh The commands will be run as root. 4. Checksum You should now have a functioning background service that starts on boot or as launched. It's an okay virtualbox/similar replacement if you only need a single instance of linux (if you do need more linuxes, you could always hack around with chroot or something similar). Please keep in mind that this is not exactly top of the line. It works, though.