PDA

View Full Version : Enabling Remote Desktop and SSH access to Kali



yaksmen
2019-12-30, 19:13
There are multiple ways to access a Kali system remotely. Traditionally, remote access to a kali system would be performed with a text only console using SSH. There is also a method of accessing kali and getting a full desktop environment. This can be particularly useful in cases where the Kali system is installed on a separate physical system and not in a virtual machine.

Remote Desktop (GUI) access
In Kali, open a terminal window and run the following commands. Substitute your username in place of ?mike? in the examples below:

# adduser mike Add a user for remote login. Set a password and other info.
# usermod -aG sudo mike Get an updated list of installable packages
# apt-get update Get an updated list of installable packages
# apt-get install xrdp Install the RDP server
# systemctl start xrdp Start the base XRDP server
# systemctl start xrdp-sesman Start the XRDP session manager


1. Open your remote desktop client in Windows. Enter the address of your Kali system and connect. You will likely get prompted that the identity of the computer cannot be verified and asked if you wish to connect anyway. Say yes, and optionally set the checkbox to not be prompted again. When you get to the Kali login GUI, keep ?Xorg? as the session and use the username and password created earlier. Once logged in you will be able to use and interact with the Kali desktop.

Assuming everything has worked to this point, you can enable XRDP to start automatically on subsequent boots with the following commands:
# systemctl enable xrdp
# systemctl enable xrdp-sesman

Terminal (text-only) Access using SSH
In Kali, open a terminal window and run the following commands:

# adduser mike Add a user for remote login. Set a password and other info.
# usermod -aG sudo mike Get an updated list of installable packages
# systemctl start ssh Start the base ssh server

On your PC, download and install Putty (https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html). Open putty. Enter the name or IP address of your Kali system in the Host Name field. Ensure the Port is set to 22 and the Connection Type field is ?SSH?. Click open.
You may be prompted that the SSH keys are not in your system and asked if you wish to proceed anyway. Click yes. Login with your username and password that you previously setup. Remember these are case-sensitive.

marl_scot
2020-01-26, 01:50
For anyone who gets an error when running the above command :

# apt-get install rdpInstall the RDP server

This should actually be :

# apt-get install xrdpInstall the RDP server

Thanks @yaksmen this got me up and running with RDP nice and quick

iditabad
2020-01-30, 20:45
Great tutorial! Looks like it should be very useful.

I do want to note, in the "Terminal" section you have:

# systemctl start ssh Start the base XRDP server

... which is starting the SSH daemon, not the XRDP server so that comment may need to be changed!

yaksmen
2020-02-10, 05:26
Thanks very much for your comment @marl_scot! I have fixed it in the entry above as well.

yaksmen
2020-02-10, 05:27
Thanks for the comment @iditabad! Fixed in the original post :-)

bun_baker
2020-04-10, 16:21
Hi

Is this working on a 2020 Kali installation becuase a clean install of 20201b works up until clicking the `OK` button in XRDP and then screen goes black and the rdp session is terminated.

Have made sure the colour depth is 16bit - any thoughts ?

Regards

eliassal
2020-05-15, 18:03
Hi, I followed the steps and was able to RDP with root but not the user I use. myuser has sudo privileges. What I am missing? Thanks

TomK
2020-08-13, 12:14
Hi

Is this working on a 2020 Kali installation becuase a clean install of 20201b works up until clicking the `OK` button in XRDP and then screen goes black and the rdp session is terminated.

Have made sure the colour depth is 16bit - any thoughts ?

Regards

Hello,
I have the same issue in our Org. None of my colleagues is able to connect via xrdp to KALI 2020 v.1/2. We could get there using KALI 2019 and older versions, but after the upgrade to KALI 2020 it's no longer possible.
We found out that the problem might be related to authentication to Gnome GUI, actually the error messages we managed to found are related to gnome-keyring-daemon. And also something with /etc/pam.d/common-auth.

In /var/log/auth :
Jul 19 04:37:52 la gnome-keyring-daemon[1510]: couldn't access control socket: /run/user/1001/keyring/control: No such file or directory


Can onyone from the KALI team look at it, pls?
Thx

daunce
2020-08-30, 00:07
I was able to get Remote Desktop working with Kali 2020.3


sudo adduser <new username> # Not really required, see further down.
sudo apt-get update
sudo apt-get install xrdp
sudo systemctl start xrdp
sudo systemctl start xrdp-sesman


I had to ensure the user logging in via RDP was NOT already logged into the console.

Then using Windows mstsc.exe, keep the session as Xorg, and I was able to log in fine.

Once tested:
systemctl enable xrdp
systemctl enable xrdp-sesman


Thanks OP!

xaveedra
2020-12-17, 10:13
It's working fine with Kali 2020.4 with the same steps

make sure you log out from kali gui and retry to connect using rdp from wherever you want, it would work

zipwire
2021-01-19, 20:55
I have a problem with the black screen after authentication, or the RDP client will just quit. XRDP logs show a successful connection, then closed socket.
I can log in with the built in Kali user, but all other users have an issue. I have the VM hosted on Virtualbox 6.1.10.
I followed the following guide to set up RDP, removed packages, then installed them, same issue: https://www.kali.org/docs/general-use/switching-desktop-environments/
I have created two users, both aren't able to connect. I have got it to connect a couple times, immediately after reloading the xrdp service or rebooting the VM.
Oddly, the background is black which suggests to me it's something to do with DE