Dec 11, 2020 by Georgi Nikolov | 313 views
For years, there has been an OS war between Linux, Windows and macOS for dominance. Each side would vehemently defend their OS of choice and disregard any positive sides of their "opponents". Of course, each operating system has its benefits and drawbacks and it is not my job or place to say which is the best.
Personally, I have always liked Windows. I started playing around with computers in the old days of MS-DOS, but very fast switched to Windows 95. From there, I lived through each new iteration of the Windows OS (except Vista, I think my brain blocked those painful memories away). But for couple of years now, I also started using the Linux distributions, and more precisely Ubuntu. At first, using the command line was a bit of a hassle and not as easy as expected, but with time I learned to love the freedom that this tool provides.
Luckily, the newest version of the Windows OS, Windows 10, has shown a shift in ideology- "if you can't beat them, join them", or at least try to work with them! Starting with the latest versions of Windows 10, it is possible to run Linux on your Windows 10 and enjoy all the freedom the Linux distributions provides!
When I talk about the Linux Bash Shell, I am not speaking of a Virtual Machine, a docker container, or a Linux program that was compiled to run on Windows. The Windows 10 OS has the capability to run a Subsystem intended specifically to run Linux software. It can be compared to Wine, where Wine serves to run Windows application on Linux, the Bash Shell does the opposite - run Linux binaries on Windows.
Technically, what Windows does is not run what we officially know as Linux, as Linux is the underlying operating system kernel. Here the OS will run a Subsystem and execute a Linux distribution atop of it. This is not a Virtual Machine, but a complete Linux system inside your Windows 10!
To be able to enjoy the use of the Linux command line in Windows 10, its imperative to update your OS to the latest available version. Also, it is important to note that this feature does not work on Windows 32-bit version, to use it you will need to switch to Windows 64-bit version.
We will also need to turn on the Developer Mode, which gives us extra freedom in how we install and manage programs and data on our machine.
To accomplish this, we need to go to
Settings -> Update & Security -> For Developers and select the radio button for "Developer mode".
Afterwards, we need to activate the Windows Subsystem for Linux. To do that, we activate this feature by going to
Control Panel -> Programs -> Turn Windows Features On Or Off.
A restart of the machine is needed at this point.
The next step is to actually install the Linux Bash on the machine. Previously, it was possible to just run the
bash command via the Command Prompt, but that sadly is not possible any more. When you do that, a message is shown detailing that distributions are missing and pointing to a Microsoft Store link, that can be followed, to install the aforementioned distribution. Sadly this link is broken and leads to an error page.
But don't be alarmed! With the latest version of Windows 10, the Linux Subsystem can be installed via the Windows Store, by using the search term "Linux".
After installation, the corresponding application can be launched. When the Linux Bash Shell is launched for the first time, a short installation has to be conducted. Afterwards, you will need to select a UNIX username and password. When this steps are completed, you can freely use your bash to install and run Linux binaries.
If you are like me and use Kali Linux for penetration testing, using the Metasploit Framework, you can now do that too via the Windows 10 Linux Bash Subsystem, without the need to install a Virtual Machine!
To be able to run the Metasploit Framework through the Kali Subsystem, first you need to tell your Windows Security to ignore the "suspicious" nature of Kali. To do that, you need to go to
Windows Security -> Virus & Threat protection and select
Manage Settings under the Virus & Threat protection settings field. Once there, scroll down to
Exclusions and select
Add or remove exclusions. From there you can add a new exclusion for the Kali Subsystem, usually found under your
User folder -> AppData -> Local -> Packages.
With that out of the way, we can launch the Kali Subsystem and wait for the distribution to install. Afterwards, we just need to run the following commands:
$~ sudo apt-get update $~ sudo apt-get install metasploit-framework
It is imperative to run the
update command before installing the Metasploit Framework, or it will throw an error.
Now we are ready to use Linux Subsystem, running on our Windows 10 machine!