Kali Linux desktop (xfce) on Windows using WSL2

I highly suggest you to install and use Windows Terminal that works with powershell, powershell core, command prompt, WSL, WSL2, …

Install WSL2 on Windows

  1. Open PowerShell as Administrator and run

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

  2. Now restart and update windows to get WSL2

    • Running Windows 10, updated to version 1903 or higher, Build 18362 or higher for x64 systems.
    • Running Windows 10, updated to version 2004 or higher, build 19041, for ARM64 systems.
    • Please note if you are on Windows 10 version 1903 or 1909 you will need to ensure that you have the proper backport, instructions can be found here.
    • Check your Windows version by selecting the Windows logo key + R, type winver, select OK. (Or enter the ver command in Windows Command Prompt). Please update to the latest Windows version if your build is lower than 18361. Get Windows Update Assistant.

  3. Enable the ‘Virtual Machine Platform’ optional component

    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

  4. Restart and set WSL2 as your default version

    wsl –set-default-version 2

    If you see a message like WSL 2 requires an update to its kernel component follow this link https://aka.ms/wsl2kernel and install the MSI from that page.

Install Kali Linux

  1. Install Kali Linux from Microsoft Store
    https://www.microsoft.com/it-it/p/kali-linux/9pkr34tncv07?rtc=1
  2. Run Kali Linux from start menu and configure it as requested
  3. Open again Kali Linux and install the desktop using win-kex
    1. sudo apt update && sudo apt full-upgrade -y
    2. sudo apt install kali-win-kex -y
  4. Now run kex and you’re ready to go
    • kex (run a desktop and leave it running until you stop it)
    • kex stop (to stop the current desktop)
    • kex wtstart (to run a desktop connected to a windows terminal tab, when you close the tab the desktop will be killed, when you close the desktop, you can re-open it or kill)
  5. If you want a lot of more tool you can install the large edition of kali
    • sudo apt install kali-linux-large

Move Kali to Different Hard Disk Drive

  1. wsl –terminate kali-linux
  2. wsl –export kali-linux “D:\kali-linux.tar”
  3. wsl –unregister kali-linux
  4. uninstall Kali Linux from start menu, right click, uninstall
  5. wsl –import kali-linux “D:\wsl\kali-linux” “D:\kali-linux.tar”
  6. wsl –set-default kali-linux
  7. open a terminal on kali
    wsl -d kali-linux
  8. restores default user, creating this config file
    sudo nano /etc/wsl.conf
  9. add the username you have configured the first time you installed kali linux before exporting it
    [user]
    default=mdenny
  10. close the terminal
  11. wsl –terminate kali-linux
  12. reopen the terminal

Turn Off Monitor when using Chrome Remote Desktop

Reference: Control use of Chrome Remote Desktop

Enable Curtain Mode for Chrome Remote Desktop

Note for Windows users: This feature only works on Windows devices running Windows Professional, Ultimate, Enterprise, or Server.

To enable Chrome Remote Desktop to prevent someone physically present at a host machine from seeing what a user is doing while a remote connection is in progress, check the steps below.

Steps for all Windows installations:

Note: The parent keys may not exist (even with Chrome installed) and will need to be created. The “1” is of type DWORD-32.

  1. Using Regedit, set HKEY_LOCAL_MACHINE\Software\Policies\Google\Chrome\RemoteAccessHostRequireCurtain to 1.
  2. Enable RDP connections to the machine by unchecking Control Panel\System and Security\System > Remote settings > “Allow connections only from computers running Remote Desktop with Network Level Authentication (recommended)”.

Additional step for Windows 10 installations:

Follow the steps above for all Windows installations, and then do the following after step 2:

Set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\SecurityLayer to 1.

For additional information on this key and value, please see Configure Server Authentication and Encryption Levels on the Microsoft Windows Server website.

Change default language on Bash on Ubuntu on Windows

I always forgot how to change the language on ubuntu, my windows knows that I’m Italian even if my operating system is set to be in English, and installs the bash on ubuntu on windows in Italian 😦 so I always need to do these steps:

  1. Install the language pack you want

    sudo apt-get install language-pack-en language-pack-en-base manpages

  2. Change the default language

    sudo update-locale LANG=en_US.UTF8