Updated: Dec 28, 2022
Welcome back my aspiring cyber warriors!
As most of you know, I am the author of the best-selling book, Linux Basics for Hackers from No Starch Press. I was inspired to write it from experience teaching hacking to US military and intelligence personnel. Over and over again, I found very talented students who were stymied in their pursuit of penetration testing/exploitation/hacking careers by their unfamiliarity with Linux. Many very good people have spent their careers in Windows or MacOS and have never used the Linux command line. Linux Basics for Hackers was designed to fill that gap in quick, accessible and un-intimidating way with examples from hacking and cybersecurity.
The superiority and versatility of Linux is not limited to hacking and cybersecurity. About 70% of the Internet servers and cloud servers run Linux. To advance in your career in IT security, Linux is almost an essential.
Now, Microsoft--of all companies--has acknowledged the advantages of Linux and has developed a way to use your favorite Linux distribution inside Windows. They call it WSL or Windows Subsystem for Linux. For some of you, this may be the easiest way to become familiar with and use Linux and start your career in cybersecurity!
In this tutorial, we will install our favorite Linux distribution, Kali Linux, inside Windows 10 and set it up for pentesting and other administrative tasks.
Step #1: Enable WSL
The first step is to enable WSL on your Windows 10 system. Simply open Powershell and enter:
PS> Enable_windowsOptionalFeature -Online - FeatureName Microsoft-Subsystem-Linux
As you can see above, Powershell will then prompt you whether you want to restart your system to enable WSL. Hit ENTER
Step #2: Install Kali Linux
Now that you have enabled this feature in Windows and restarted your system, you will need to install Kali. Go to the Windows Application store
There, you will see icons for many major Linux distributions. Click on Kali Linux.
This opens up a screen like that below.
Click on the Blue Get button.
Kali will begin to download. This is stripped down, essentials-only version of Kali so the image is much smaller than what you may be accustomed to and the download is much quicker.
Once the download is complete, you will then be prompted for a username and password.
Step #3: Install Kali Tools
The minimal version you just installed has little-to-no tools (it depends on your definition of the word "tool"). At this point, we need to download all the Kali tools to our Linux. To do so, enter the following command to update, upgrade and install all the tools from the Kali repository.
$ sudo apt update && sudo apt upgrade -y && sudo apt install kali-linux-everything -y
You will need to enter your username and password to proceed.
This can take quite awhile, so take a break and get your favorite beverage.
Step #4: Check the Networking Settings
In this step, we will run ifconfig to test our network setting
$ sudo ifconfig
Note a few things. First, your first Ethernet connection is designated eth1. Also, your Wi-Fi adapter is designated wifi0. This may be different than you are accustomed to running Kali natively or in VirtualBox.
Now, open a command prompt on your Windows host system and run ipconfig.
Note that the IP addresses of each of the interfaces is the same as the Linux system. Windows and Linux are sharing these interfaces. This is further confirmed by noting the MAC addresses of these interfaces. They are the same on both operating systems. This is notably different than your Oracle or VMware VM's, where the interfaces have different IP's and MAC addresses.
Step #5: Enable ping
Unfortunately, several functions on this virtualized Linux are not enabled by default. One of these is ping, the Linux utility for testing whether a host is up. When we try to ping another system on our local network or google.com, both return the cryptic message,
ping:socket: Operation not permitted
To enable ping on our newly install Kali Linux system, enter the following command;
sudo setcap cap_net_raw+p /bin/ping
After do so, you can see in the screenshot above, that we can now ping google.com.
We are now ready to use our trusted Kali Linux within Windows 10 for our hacking/pentesting and cybersecurity activities!
Linux is the operating system of choice for hackers, web site hosting, cloud providers and many more IT security professionals. It is essential that you gain a thorough understanding of at least it must fundamental capabilities and utilities. For many of you, Microsoft's new WSL might be just the thing to get you started using Linux. For the seasoned Linux user, WSL makes it quick and easy to drop into Kali Linux from your Windows 10 system and test your tools and scripts. I still recommend a native install for professional penetration testing, but WSL can provide an easy to use test bed between jobs.