categories
Updated on in

Remote Access Kali Linux over RDP and SSH

Author: Robert Agar
Robert Agar Article author

There are two primary ways of Kali remote desktop access. First is RDP, with the use of xrdp – a freely available RDP server application. Second, if your Kali installation is text-only and you don’t want to set up a desktop environment, it can still be accessed over SSH. Keep reading to learn how to establish a Linux remote desktop session.

Find Out Your IP

Before your computer can be connected to for a Kali RDP or SSH session, the guest needs to know its IP address. You can find out your address by using the ip a | grep inet command, and finding the address with a “global” scope – in this case, it’s the wlan0 adapter, responsible for the first Ethernet port on a motherboard.

Finding your address with ip a

Basic xrdp Kali Startup

In order to start a Kali Linux RDP server, you need to do the three following things: update the system, install all necessary packages, edit a configuration file (optional), add a firewall exception (also optional), and finally, start the Xrdp service.

Kali uses the apt package manager, so apt update and sudo apt upgrade should get your system up-to-date:

Updating the system before anything else

You need the kali-desktop-xfce, xorg, and xrdp packages for the server, but the former two are installed by default on most Kali systems, so we will just get xrdp with apt:

xrdp will host an RDP server on your OS

Next, there are two optional steps. First, you can edit the /etc/xrdp/xrdp.ini file to change the port used for RDP sessions. It’s 3389 by default, but 3389 is also used by some other remote desktop Linux applications, such as VirtualBox, so you might want to change it to avoid conflicts. You can use sudo nano or any other text editor for this:

Configuring xrdp via text editor

The ufw package is not installed on Kali by default. However, if your system has it installed, you will need to add an exception for the port – for example, sudo ufw allow 3390.

Finally, run xrdp restart, and the service is running!

Important  – RDP sessions can only be started with a user that is currently logged out. So exit to the login screen on the host computer whenever the guest needs to connect!

Now the computer can be accessed from RDP clients on Windows and Linux.

How to Connect to Kali RDP from Linux

Remmina is a commonly available, easy-to-use RDP client for Linux, so we can use it to connect to a Kali xrdp server.

  1. Start by installing Remmina with sudo apt install remmina.

    Getting the remmina package
  2. Open Remmina and type [host IP]:[RDP port] into the address bar.

    Entering the RDP host's address
  3. Enter the username and the password of the remote user. Don’t forget, the user has to be logged out, or else the client won’t connect!

    Logging in on the remote machine
  4. You now have a working RDP session.

    A Kali desktop on the Kali desktop

How to Access a Linux RDP Server from Windows

We will be using Remote Desktop Connection – the client that’s available out-of-the-box on most Windows systems.

  1. The Remote Desktop Connection app can be found with the Search bar.

    Opening the Windows RDP client
  2. Enter the Kali host’s IP and RDP port.

    Host's IP and port
  3. Agree to connect, despite the warning.

    Security confirmation due to the other desktop being a Linux
  4. The xrdp login screen will open. Type in the user credentials.

    Logging into xrdp
  5. The RDP session is online.

    Accessing Kali on Windows

Connect to Kali over SSH

Unlike Kali xrdp, SSH is a purely command-line solution. However, almost everything can be done on Linux through the command line. It’s also highly useful for accessing minimal installations, or devices that don’t need a desktop environment due to not having a screen. SSH is likely installed by default on both the host and the guest systems. You simply need to start the service and connect to it.

  1. On the host, run ssh start. You will need to provide authorization.

    SSH needs authentication to start
  2. On the guest OS, run the command ssh [username]@[IP address]. Type “yes” to confirm that you want to connect for the first time.

    Logging onto an SSH server
  3. You now have a command line opened directly to the host.

Unlike RDP, you also don’t need to log out of your account to start an SSH session.

Alternatives

Remote access tools like HelpWire are a viable alternative to XRDP and VNC. HelpWire in particular provides a full suite of features intended for remote support, which is a common use for RPD sessions. While RDP and SSH work well in a pre-configured environment, a ready-made solution will require less effort and may give you the best overall result for the time spent.