Configuring the WSL GUI Kali Linux & Ubuntu. Exit to the graphical shell





Hello. Having installed WSL and downloaded Kali Linux & Ubuntu from the Microsoft Store, I was faced with the fact that I was in front of a terminal, and I understood absolutely nothing in Linux, and I would like to somehow navigate the system through the graphical shell. I googled the teams for weeks and ended up writing a script to set it up. I share, can anyone help



Once again, I will make a reservation that in Linux I did not understand anything at all, so cultural criticism and additions to the script are welcome in the comments.



Also, the difficulty turned out to be that KALI changed teams , and while following the tutorials for the 2019 version, I already ran into errors that the distribution kit was not in the repository.



The article assumes that you have already installed WSL and downloaded the distribution from the Microsoft Store, and this is a terminal. The script was written on the system on 08/26/2020



lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description:    Kali GNU/Linux Rolling
Release:        2020.3
Codename:       kali-rolling


Setting up Kali



Read the first thing at the end of the article UPDATE 2 and 3, please. Perhaps you will change your mind about doing all this.


  1. First of all, you will be asked to create a user: enter your username and password
  2. then we create a script:



    sudo nano /usr/local/bin/setup-xrdp-server.sh


    and insert the contents of the script

    UPD: . — , /tmp berez
  3. KALI LINUX



    #!/bin/bash
    echo "Sonax Kali Setup"
    
    ##     !
    port_xrdp=3390 #   RDP
    username="sonax" #.       "ask"
    password="pass"  #       "ask"
    ##  .    
    
    sudo apt update -y && sudo apt upgrade -y
    sudo apt install -y kali-desktop-xfce xrdp #  Ubuntu  kali-desktop-xfce  xubuntu-desktop
    
    #XRDP
    sudo cp -n /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak #( )
    sudo sed -i 's/3389/'$port_xrdp'/g' /etc/xrdp/xrdp.ini #(    3389     )
    sudo sed -i '186s/username=ask/username='$username'/g' /etc/xrdp/xrdp.ini #(,   )
    sudo sed -i '187s/password=ask/password='$password'/g' /etc/xrdp/xrdp.ini #(,   )
    #sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini #(  32,  128   ) UPD:  ,       .
    #sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
    sudo /etc/init.d/xrdp start
    #END XRDP
  4. "## !" ( ), , . (cntrl+x ->y->enter).
  5. Chmod,



    sudo chmod ugo+x /usr/local/bin/setup-xrdp-server.sh
  6. setup-xrdp-server.sh
  7. ,
  8. xrdp , , .



    sudo /etc/init.d/xrdp start






    sudo service xrdp start
    {start|stop|status|restart|try-restart|force-reload}
  9. RDP Windows, RDP mstsc
  10. localhost:3390 ,


Ubuntu



On Ubuntu, everything is the same, except instead of kali-desktop-xfce, enter xubuntu-desktop .



Conclusion



Thanks for reading the article. If there are wishes / remarks / threats / blackmail / violence in the comments , the article will be supplemented / updated. Hope it is useful to someone.



UPD1: Autostart

on startup (thanksberez)

sudo systemctl enable xrdp.service




UPD2:

Kali Linux got a GUI for Windows Subsystem for Linux (WSL2). Installation instructions .

thanksalex-khv...

This decision was implemented quite recently, August 18, 2020, here's the news . It is possible without RDP. I did it.




UPD3:

WSL does not see the physical Wi-fi interface, so Kali on WSL is useless today, we are waiting for updates.

On the Internet they write that you can throw USB-Wifi into the system through VMWare virtual machines, Oracle Virtual Box.

But, unfortunately, this did not work for me, I have 2 USB Wi-Fi adapters.

Nevertheless, many people unsubscribe about the success of this procedure.



All Articles