Do you want to run the Kali Linux operating system on Windows subsystem for Linux on Windows 10 but GUI- Graphical user interface? Then here is the solution.
WSL on Windows 10 has been around for quite some time now but most of the time we use it with command-line interface since it comes with that only by default. However, if you know how to handle commands then this article might not be that much useful for you. But those do not they definitely want to install Graphical user interface on WSL- Windows subsystem for Linux.
Moreover, it is not that much difficult as it sounds, what we need is the installation of some Desktop environment on WSL Linux such as Kali, Ubuntu or Debian and then accessing it using WIndows 10 default RDP (Remote Desktop) protocol. This means no third party tool just need some opensource files on the existing tools.
Yet, running GUI for Kali Linux running on WSL(Windows Subsystem for Linux) can be a good idea for the learner. But if you want a Linux with GUI for some professional work then it is recommended to use VM on VirtualBox or VMware.
Kali Linux GUI installation on Windows 10 Subsystem for Linux (WSL)
Let’s start with the tutorial to see the steps that are required to operate Kali Linux WSL using GUI.
Step 1: Install Kali Linux on WSL Windows 10 or server
You can either install Kali or Ubuntu to follow the steps given in this tutorial. However, as this guide focuses on Kali, thus we will go with that. Just enable WSL on Windows->Go to Microsoft Store-> Search for Kali App-> Click on Get and then Install.
Here is the detailed guide on Kali Linux installation on WSL.
Step 2: Update Kali Linux
If you already have the Kali on your system then before moving further just update its installed packages to their latest state. Here is the command for that.
sudo apt update
Step 3: Install XFCE on Kali WSL Linux
Although we can install the open-source GNOME desktop environment on Kali WSL, to make it lightweight so that we can easily access it using Windows Remote Desktop tool even on standard resources computer system, we use Xfce DE.
The latest version while writing this article of the XFCE Desktop environment was 4.xx.
sudo apt-get install xfce4
The installation will take some time depending upon your internet connection, the total size of files the KALI or Ubuntu WSL will download for the setup of XFCE GUI will be around 124MB. When it asks you to confirm the downloading of files, type Y and proceed further.
Step 4: Install XRDP on WSL
After the installation of the XFCE 4 desktop environment, we have GUI on our Kali WSL but now the thing how to access it. We can’t directly boot Windows subsystem Linux with GUI like any other operating system, however, still the DE process is running in the background which we can access using RDP tool.
XDRP is a free and opensource counterpart of Windows RDP server that makes other operating systems such as Linux to easily access them using RDP clients of FreeRDP, rdesktop, NeutrinoRDP and Remote Desktop Client (for Windows, macOS, iOS and Android).
To install it on WSL, use this command:
sudo apt-get install xrdp
Step 5: Start xrdp server
Finally, start XDRP server installed above, so that we can access of Kali GUI using the default Remote Desktop client present on Windows 10.
sudo /etc/init.d/xrdp start
You will see a port number 3389, note that.
Step 6: Connect to Kali using RDP
Simply go to Windows 10 search box and type- Remote desktop., as its icon appears, click on it to start.
Now, enter localhost:3389 and hit the Connect button.
If you get an error “Your computer could not connect to another console session on the remote computer because you already have a console session in progress” it is because WSL running Linux by default share the same port and IP address of host computer; thus we cannot connect the same computer where we are trying to use RDP client, therefore we need to change the port number of our WSL XRDP server.
For that, edit the XRDP configuration file using the below command on Kali Linux.
sudo nano /etc/xrdp/xrdp.ini
Change the default port 3389 of XRDP to 3390. To save, press Ctrl+X and then type Y and hit the Enter button.
Restart XRDP server:
sudo /etc/init.d/xrdp restart
Now, again connect using RDP with this address- localhost:3390
Step 7: Start using Kali Linux XFCE GUI on WSL Linux
When you connect it, a warning message will appear, ignore that and click on the Yes button.
After that enter your Kali Linux username and password
Finally, you have the Graphical user interface for Linux app running on the WSL.
See this tutorial -If you just want to Linux GUI apps on WSL.
Hello Rajkumar,
could there be some reasons, why this should not work, if followed step by step?
I sign-in to remote desktop and have just black window with command line
sudo apt install dbus-x11
use this command in root user it should work
https://www.reddit.com/r/Kalilinux/comments/jt7k6c/kali_linux_gui_on_wsl2_error_when_using_kaliwinkex/
Great article, thanks for detailed guide!
same
nvm it works had to reinstall xfce
I’m getting this error!
Unable to contact settings server
Failed to execute child process “dbus-launch” (No file or directory)
Try this. In the Kali Linux cmdline, type in:
sudo apt-get install dbus-x11
Then, retry the remote connection
how do you get a kali linux username and password because i dont have one lol