WSL GUI Installation for Kali Linux

GUI remote login wsl kali linux
Share:

About

This post covers the installation of a GUI for Kali Linux running on WSL(Windows subsystem for Linux). A quick note if you are looking for Linux with a GUI this might not be the best solution. Depending on your wants and needs it might be a good idea to take a look at running a virtual machine or dual booting(or maybe just installing Linux on your machine).

This tutorial only covers the GUI installation. I am assuming that you already installed Kali. If you haven’t I have a tutorial here that goes over installing WSL and Linux on your computer.

WSL GUI Instalation for Kali Linux

Old (Doesn't work anymore)

Using wget we will download a script which will install xfce for us. Xfce is a desktop environment for our OS, basically our GUI. 
  1. wget https://kali.sh/xfce4.sh
Type sudo sh xfce4.sh to run the script. This will take a while to get installed. During the installation, you will be asked to select your keyboard layout. It’s pretty easy and intuitive so I didn’t even include it here.

The Other Way To Install XFCE

First update your system.
  1. sudo apt update
  2. sudo apt upgrade
Install xfce.
  1. sudo apt-get install xfce4
Install xrdp.
  1. sudo apt-get install xrdp
Once the install is complete you will  need to start xrdp by typing:
  1. sudo /etc/init.d/xrdp start
Once starting xrdp all that’s left to do is to connect to Kali. The machine is running on localhost so the IP to connect to is localhost:3390 (with port 3390). I will use the remote desktop connection program that comes with Windows. 
Type in the username and password.
And here is our GUI.

Possible Problem

If xrdp is running on port 3389 and not on port 3390 you will get this error:

Your computer could not connect to another console session on the remote computer because you already have a console session in progress.

To fix this error you need to change the port. To do so open up the xrdp configuration file:
  1. sudo nano /etc/xrdp/xrdp.ini
Change the port=3389 to port=3390 and save the file.
After changing the config file xrdp has to be restarted.
  1. sudo /etc/init.d/xrdp restart
After xrdp has restarted you can try to connect again.
Share:

Comments

  1. Remote desktop connection doesn’t work… :/
    It says:

    “Remote Desktop can’t connect to the remote computer for one of the reasons:
    1) Remote access to the server is not enabled
    2) The remote computer turned off
    3) The remote computer is not available on the network
    Make sure the remote computer is turned on and connected to the network, and that remote access is enabled.”

    I don’t know what’s the problem…

  2. Thank God for this! I had been searching for a working version for me (hex or whatever it was wasn’t working and crap) I’ve been looking so hard to find this! Thank You for the Tutorial. Very Helpful.

  3. Hi, thanks for your post.
    I just had a small problem, different then you, my sudo nano /etc/xrdp/xrdp.ini had a lot of 3389, I changed all of them to 3390, but when I log in into the “DTPC” at the remote desktop, I just get a black screen for 10sec and it shuts down.
    I don’t know if you can help me out, but I’ll show de difference in the code bellow.
    PS:All these 3390’s were 3389.

    space between multiple occurrences
    ;
    ; Examples:
    ; port=3390
    ; port=unix://./tmp/xrdp.socket
    ; port=tcp://.:3390 127.0.0.1:3390
    ; port=tcp://:3390 *:3390
    ; port=tcp://:3389 192.168.1.1:3390
    ; port=tcp6://.:3390 ::1:3390
    ; port=tcp6://:3390 *:3390
    ; port=tcp6://{}:3390 {FC00:0:0:0:0:0:0:1}:3390
    ; port=vsock://:
    port=3390

    ; ‘port’ above should be connected to with vsock instead of tcp
    ; use this only with number alone in port above
    ; prefer use vsock://: above

    1. You only had to change the “port=3389” to “port=3390”. Changing anything else should be unnecessary, also it’s all commented out with “;” so those settings won’t actually do anything.

      All in all your settings file should be fine. 🙂

      Connect to this address: localhost:3390
      When prompted enter your username and password.

      Note: “DTPC” is my username in the tutorial, you should enter yours when trying to connect.

    1. Do you get this error when you try to connect via RDP? Do you get this error message in the terminal or in the GUI is what I am trying to ask?

        1. Do you get this message after running this: “sudo /etc/init.d/xrdp start” command?
          Is it possible the service is actually already started? Maybe you can just try to connect using RDP.

  4. Thank you so much !!! I’ve been struggling with this, I wanted to avoid using a VM because it’s just really slow and with my laptop it’s kinda annoying to use + my fan start screaming. I’ve watched a lot of youtube videos, some too old, some more recent but when I wrote “127.0.0.1:3389” it did’nt find kali linux running, I literally spent hours, reinitialising my kali linux after the failures, and tried this tutorial I found thanks to a yt comment as a last ressort.

    Anyway, it’s really clear and finally worked so I just want to express how glad I am that you made this. Now all that’s left for me is learning how to use it lmao ^^

  5. Thank you! Finally got it to work! I DID have to edit the ini file to 3390, then (Write Out ^O), (Exit ^X), which saves the changes in nano editor. Not sure what happened the first time. I knew it was trying 3389 because i saw the ini file later, and if i just put in 3389 it would say session already in progress. Fixed and saved the ini. Killed Remote Desktop. Did the xrdp restart. Connection made, Kali GUI screen!

    Thanks again amigo!

  6. I really hope you reply because I have been seeking help for a week… restlessly. The blue screen after typing (127.0.0.1:3390 or localhost:3390
    , and then my username and password) freezes and doesn’t connect..i really don’t know what to do but I suspect it is from the script on the nano menu. Your help would really be appreciated because I have tried so hard and I have no IT knowledge.

    1. Can you post the init.d file contents so I can see if that is indeed the problem? But if you get to the login screen I think that the XRDP settings file we are talking about should be fine. Sounds like the problem could be with xfce. So maybe also try installing that again. You can do it by using this command: sudo apt-get install xfce4

  7. the terminal is not opening it says “failed to open default terminal and input/output error”. it’s also not connected to internet

    1. You mean the when you are in windows and try to start up Linux you then get an error. Or did you already successfully log in to Linux via remote desktop and the terminal application in there doesn’t’ work?

      1. yes i already login in linux via RD and terminal application inther is not opening and no internet too

    2. I resolve it like this :
      Application, setting, setting manager, preferred application, Uilities, Terminal emulator: Xfce Terminal
      (A existing terminal)
      best regards,

  8. I installed as you have mentioned ö but Remote Desktop never appeared??

    The commands worked – but no change in picture

    1. Do you get any errors? And by “Remote Desktop never appeared” do you mean it failed to connect or did it connect and you have a blank screen?

      1. sudo /etc/init.d/xrdp start
        Starting Remote Desktop Protocol server: xrdp-sesman xrdp.

        after this command REMOTE DESKTOP not appearing ,plz help

        1. I think you misunderstood the xrdp start command. It starts the remote desktop service on the Linux OS. I won’t start a GUI(like the startx command). After the remote desktop service has been started you need to open something like the Remote Desktop Connection application on Windows and connect to the Linux OS with it. This is the address you need to connect to: localhost:3390 See the screenshot in the tutorial above.

  9. I was super glad to find this tutorial since the GUI linux subsystem seems to be a way to solve some up-to-now unsolved issues. Every step worked out fine until I wanted to log in to RDP. Obviously you need to have Win 10 Pro to use it, right? Haven’t understood yet if using teamviewer could an option. Should give it another try tomorrow. Any advice would be appreciated.

    1. I don’t think TeamViewer can connect via RDP. For TeamViewer to work it would have to be installed on both systems.
      I don’t know if the RDP application that comes with windows is exclusive to the pro version. But you can use any other RDP software. You can just google “free RDP software” and get one.

  10. continuo ad accedere da desktop remoto , però compare scritto “impossibile connettersi al PC remoto.Verifica che il PC sia acceso,connesso alla rete e con l’accesso remoto abilitato. ho provato in tutti i modi .

    1. You could either be connecting to the wrong IP, wrong port or both.
      Also are you sure that the xrdp service is running? You can use this command to see if it is: sudo service xrdp status

  11. when i type sudo /etc/init.d/xrdp start it says Remote Desktop Protocol server: xrdp-sesman xrdp failed!
    when i run it first time it works fine but now it is not working what i do i also change port 3390

  12. Okay, I followed all these steps. My port 3389 was being used, so I changed it to successfully. I can open RDP and get the login screen, but after it tries to connect, it throws an error message saying: “Oh no! Something has gone wrong. A problem has occured and the system can’t recover. Please contact a system administrator.”

    Any idea what this might be? I went and purged my xrdp install and reinstalled it (like you had someone do above). After still getting this error message though, I went ahead and did a full install, just to make sure I didn’t miss anything. But after having it install all night and following your instructions again, I still get the same issue.

  13. hello I need help when i try strating the rdp by the following command using sudo /etc/init.d/xrdp startit only returns me Starting Remote Desktop Protocol server: xrdp-sesman xrdp. and there is no ip address or port number what should i do

    1. I am having the same problem. i tried to connect using remote desktop connection and it does not wok plz help

  14. Hello.
    anyone can help i wasn’t able to do any installation process. i always get this message
    ( #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.
    [sudo] password for chess:

    and doesn’t allow me to type my password.

    1. I think what is happening is that you are actually typing in the password. But the terminal doesn’t show any * or dots therefor you thought that it is not letting you type in the password.
      This is meant to be this way and is normal. Just type your password in and press enter.

  15. Hi,

    i have install Kali Linux with WSL2. But i can’t connect with RDP. I’ve used the IP (172.26.242.X) for the VM, change the Port. Have you an idea?

    1. Sorry but I haven’t used WSL2 yet so I don’t know how much different it is to WSL. I can just suggest you double-check everything and make sure that xrdp is running on the correct port. As I said I am not familiar with WSL2 but the IP address you are connecting to doesn’t seem right to me. I think you should be connecting to localhost:3390 or 127.0.0.1:3390 .

      1. I had a working solution using WSL but after switching to WSL2, I also can’t connect anymore with RDP.
        It looks like the port just isn’t available but I can’t put my finger to it.

        Starting xrdp returns this
        —————————————–
        sudo /etc/init.d/xrdp start
        Starting Remote Desktop Protocol server: xrdp-sesman xrdp
        [20200114-20:29:08] [DEBUG] Testing if xrdp can listen on 127.0.0.1 port 3390.
        [20200114-20:29:08] [DEBUG] Closed socket 6 (AF_INET6 ::1 port 3390)

        Netstat looks ok though
        —————————————–
        netstat -an
        Active Internet connections (servers and established)
        Proto Recv-Q Send-Q Local Address Foreign Address State
        tcp6 0 0 ::1:3350 :::* LISTEN
        tcp6 0 0 ::1:3390 :::* LISTEN

        nmap otoh shows the port is closed
        ————————————————————
        nmap localhost -p 3390
        Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-14 20:36 CET
        Nmap scan report for localhost (127.0.0.1)
        Host is up (0.000098s latency).

        PORT STATE SERVICE
        3390/tcp closed dsc

        Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds

        /var/log/xrdp.log shows the following
        ————————————————————–
        [20200114-20:29:08] [DEBUG] Testing if xrdp can listen on 127.0.0.1 port 3390.
        [20200114-20:29:08] [DEBUG] Closed socket 6 (AF_INET6 ::1 port 3390)
        [20200114-20:29:10] [INFO ] starting xrdp with pid 32564
        [20200114-20:29:10] [INFO ] listening to port 3390 on 127.0.0.1

        psping started from my host machine also show a closed port
        —————————————————————————————————–
        psping -4 localhost:3390

        PsPing v2.10 – PsPing – ping, latency, bandwidth measurement utility
        Copyright (C) 2012-2016 Mark Russinovich
        Sysinternals – http://www.sysinternals.com

        TCP connect to 127.0.0.1:3390:
        5 iterations (warmup 1) ping test:
        Connecting to 127.0.0.1:3390 (warmup): from 0.0.0.0:11858:
        The remote computer refused the network connection.

        => So I’m not sure what to make all of this.
        Starting the service shows a closed socket but netstat and the xrdp.log file show port 3390 being used and listened to.
        Testing the port using nmap or psping on the other had show that the port is closed.

        If you have any idea how to proceed from here, much appreciated

        1. “The remote computer refused the network connection.” I am not sure but one thing that comes to my mind is a problem with the firewall? The log files show that the services are running on those ports but you are unable to connect to them. This also seems like it could be the firewall blocking the connection.

          1. Thank you for you reply. I didn’t manage to nail it down and switched for the time being back to a virtual machine.

  16. Hi Tsla, thank you for your tutorial, I successfully put in place the GNU but something is off, I just can’t seemt o use any of the programs in it beside docs and text editor. If I open terminal it says: Failed to execute default Terminal Emulator. Input/Output error.
    Whereas other programs such as mozilla, Kali docs, Kali bugs and so on it opens a Mozilla page and crashes instantly saying:”Firfox had a problem and crashed”

      1. Upon making the change press CTRL + X to exit the nano text editor.
        Before exiting, the editor will ask you if you want to save the changes.
        Press Y and then enter.

  17. Hey. Thanks for the instructions.
    Still got a problem : Everything works but when I connect to the Remote it starts up a Terminal / Console not the GUI. So yeah if you could help me that’d be very nice. Thanks 🙂

    1. Maybe something didn’t install/install correctly.
      Try updating your Linux installation and then try install xfce again.

      sudo apt-get upgrade
      sudo apt-get install xfce4

  18. Sorry to bother you. But I have this problem
    I changed my port to 3389 to 3390. then when I restart the xrdp, nothing happens.
    There is no “ok” text as your screen shows when you start the xrdp,
    Do you know what is going on ?

    1. Oh I login into remote desktop connection, GuI is not displayed, it just shows the connection log messge.
      Do you know what is wrong here?

    2. When you say nothing happens is there no output at all not even an error? And if you change the port back does it start up then? Is it possible that you unknowingly modified something in your config file and broke it as a result?

  19. Sorry to bother you, but I am receiving the error message with the remote desktop connection

    Remote Desktop can’t connect to the remote computer for one of these reasons:
    1) Remote access to the server is not enabled
    2) The remote computer is turned off
    3) The remote computer is not available on the network

    This happens despite all the other installations working and running fine. I can ping the internet in the Kali wsl console so it is connected to my network and the wsl terminal is open and turned on. I can’t understand what is going wrong.

    1. It sounds like you are either connecting to the wrong address or xrdp isn’t installed/isn’t running. But as you said you have installed xrdp and you have it up and running. Could you post the IP you are connecting to? You should be connecting to localhost or 127.0.0.1.

      1. Thanks for the advice. I checked what port it was trying to use and it turned out that it was trying to run on port 3389 so it was just that problem, I used your solution and it worked fine. Thanks a lot 🙂

        1. You need to put in whatever username and password you used whenever you first installed kali Linux on wsl.

    1. If you look in the taskbar you should see an icon with a compass(4th icon in the row). That is the default browser. Or is that icon somehow not present?

    1. Sorry, I don’t quite understand your question. If you are being asked to install more packages confirm it by pressing Y and then press the enter key.

  20. Hi,

    Thanks for the tutorial, but i’m encountering an error where I start up the Remote Desktop Connection,

    I can login succesfully with my credentials (Xorg) but when after I press ok, it just gives me another Kali terminal which i was getting in my command prompt anyways, there is no GUI.

    Please help.

    1. Sounds like xfce is not installed or not installed properly.

      Try this to remove it: sudo apt-get purge xfce4

      Then follow the tutorial to reinstall it.

  21. Hi,
    Using ^W I found that that there were two entries for 3389 within the ini file. I was mistakenly editing the one at the bottom of the file only.
    I have now edited both to be 3390 and can connect by RDP to XRDP but get a terminal screen rather than a GUI.
    I will continue reading

  22. I followed the instructions and changed port 3389 to 3390 then saved and exited. However, whenever I restart xrdp or stop then start xrdp over it is still on port 3389.
    Any ideas what I missed or what I’m doing wrong? Thus far your directions are the clearest and most recent I’ve found. I’d really appreciate your help.

    1. Type cat /etc/xrdp/xrdp.ini
      This will print the contents of the xrdp config file. Just to be sure look if the port in the config file was changed.

      If the port is correct then the problem is most likely that xrdp isn’t reading the newly changed config file.
      Now, restarting xrdp should usually fix it. But as you said you did that and it hasn’t helped.
      So next thing that I can think of is rebooting kali and then trying to start xrdp.

      But to restart Linux running on WSL you can’t just do a sudo reboot.
      You will have to open up PowerShell(do it as admin to avoid any potential problems).
      Run this: Get-Service LxssManager | Restart-Service

      PS:
      I just remembered if you type sudo service xrdp you will get a list of possible commands:
      Usage: /etc/init.d/xrdp {start|stop|status|restart|try-restart|force-reload}
      So maybe you can also try something like this: sudo service xrdp force-reload to restart xrdp.

        1. The username and password you chose when you installed Kali.

          Here is my tutorial for installing Linux on Windows.
          It’s for Ubuntu but is pretty much identical for Kali. Scroll down a little bit and you will see the “Enter a username and password.” part.
          This is the username and password you need to enter.

            1. Type whoami in to your terminal. As for your password if you forgot it I think the only to fix that is to reinstall Linux.

  23. Thank You so much Tsla…!!!

    I was trying to figure out this problem for a month. Finally, I modified my search as :

    wget https://kali.sh/xfce4.sh not found fix

    Then your post appeared on Google.
    That’s why, I request you kindly make some tags, so that people who are in experiencing this issue, can easily find you. Thanks Alot!

  24. Instead of installing XFCE, if you want XFCE and all the packages available for Kali, use “sudo apt-get install kali-linux-all” and you get XFCE plus all the goodies.

  25. am trying to start xrdp by typing ‘sudo /etc/init.d/xrdp start’
    this is the feedback i get
    ‘-bash: sudo/etc/init.d/xrdp: No such file or directory’
    how can i go through this

  26. When I run Kali on windows 10 and open remote desktop I get the sign in and after that I just get a terminal screen on the remote desktop and not the interface. The line reads “bash: interface: command not found”. I’m searching all over the internet to figure out what to do but getting nowhere. Any help would be much appreciated. I’d really like to get this to work.

    1. Sounds like xfce is not installed or not installed properly.

      Try this to remove it: sudo apt-get purge xfce4

      Then follow the tutorial to reinstall it.

        1. i’ve tried reinstalling it, but when connected, it is all black and it shows ” username@computer username:~$”
          *username is just an example. infact, it shows my username here please help

  27. i have been trying to install kali for a while now and i couldn’t do it completely because of this problem, so thank you so much!! a lot of love from Brasil.

    1. Upon making the change press CTRL + X to exit the nano text editor.
      Before exiting the editor will ask you if you want to save the changes.
      Press Y and then enter.

  28. You are amazing man I was so confused and you explain these steps so easily and clearly. Thank you very much brother.

  29. Anyone else having issues downloading the script? I keep getting “Connecting to kali.sh (kali.sh)|45.79.158.143|:443… failed: Resource temporarily unavailable. Retrying”

  30. When I follow the instructions to a T, it just brings me to a blank command line screen (after logging in to remote desktop)

    Any ideas why?

    1. I don’t know why. But does RDP close first and then the Kali console pops back up or is it that somehow that the console is inside the actual RDP window? (If XRDP is running and you can connect using RDP but don’t get a GUI it could be that XFCE wasn’t installed/installed properly)

    1. If remote desktop doesn’t connect make sure xrdp is running:

      sudo /etc/init.d/xrdp start

      After starting xrdp it should tell you what port it’s running on. If the port is 3389 then you have to change it. You can follow the tutorial(scroll down a bit where I describe the issue and show how to solve it).

      Connect to:
      localhost:(the port that xrdp is running on)

      Or you could try connecting to 127.0.0.1 instead of localhost
      127.0.0.1:(the port that xrdp is running on)

      This is all the help I can give you with the inforamtion you have provided me so far.

      1. Tesla when I started the xrdp it show slide this
        “Starting remote desktop protocol server: xrdp ses man xrdp[20190820-03:24:47] [debug] testing if xrdp can listen on 0.0.0.0 port 3389.
        [20190820] debug closed socket 6 (AF_INET6:: port 3389)
        OK ”
        And then I open my RDC type local host3390 and connect
        It showas that RDC can’t connect to remote computer
        1.remote access to the server is not enabled
        2.the remote coklputer is turned off
        3.the remote computer is jot available on the network what to date? Please give me a fast reply

          1. So, if I understood you correctly I think your problem could be:

            1. You might have misspelled this when you were typing the comment, but if you are actually trying to connect to this: local host3390 it won’t work. Change it like so: localhost:3390

            2. I also think your xrdp is still running on the port 3389. You need to change that port to 3390 in the xrdp configuration file. Follow the tutorial for instructions, it’s under the “Possible Problem” title.

Leave a Reply

Your email address will not be published. Required fields are marked *

The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.

Advertisment ad adsense adlogger