Enabling Remote Desktop Protocol (RDP) on Kali Linux allows you to access the system remotely with a graphical interface. Below is a step-by-step guide to setting up and enabling RDP on Kali Linux, ensuring you understand each step fully and avoid potential pitfalls.
Step 1: Update Your System
Before making any changes, ensure your system is up to date to avoid compatibility or dependency issues:
sudo apt-get update -y && sudo apt-get upgrade -y
This command updates the package lists and upgrades all installed packages to their latest versions.
Step 2: Install a GUI Desktop Environment
If you are running Kali Linux in a non-GUI environment (e.g., on a cloud provider like AWS, Digital Ocean, or Linode), you need to install a desktop environment. If you already have a graphical interface, you can skip this step.
Install the GNOME desktop environment (or choose an alternative such as XFCE):
sudo apt install kali-desktop-gnome -y
Alternatively, for XFCE (lighter and preferred for remote access setups):
sudo apt install kali-desktop-xfce -y
Step 3: Install XRDP Server
To enable RDP functionality, you need to install XRDP, an open-source implementation of Microsoft’s RDP:
sudo apt-get install -y xrdp xorgxrdp
These packages install the XRDP service and its dependencies.
Step 4: Enable and Start XRDP Service
Enable the XRDP service to start on boot and start it immediately:
sudo systemctl enable xrdp --now
You can verify that XRDP is running using:
sudo systemctl status xrdp
Ensure the status shows "active (running)."
Step 5: Configure User Accounts for RDP
Only one user can be logged in via RDP at a time. If multiple users need access, create separate user accounts for each individual.
Create a New User:
sudo useradd -m -s /bin/bash username
Replace username with the desired username.
Add the User to the Sudo Group:
If the user needs administrative privileges:
sudo usermod -aG sudo username
Set the User’s Password:
Assign a password to the user:
sudo passwd username
Step 6: Configure Firewall (if Applicable). Note: This isn't needed for many Kali installations. However, I did find that many cloud providers, such as Linode, was required.
If you have a firewall enabled, ensure that port 3389 (the default RDP port) is open:
sudo ufw allow 3389/tcp
If you’re using a cloud provider, check its security group or firewall settings to allow RDP traffic.
Step 7: Test the RDP Connection
On your local machine, open an RDP client (e.g., Remote Desktop Connection on Windows or remmina on Linux) and connect to your Kali Linux system using the IP address of the machine and the credentials of the user you created.
Address: IP address of the Kali system
Username: username
Password: user password
In the screenshots below, I am using Microsoft's Windows App for RDP on MacOS. You can download it from the MacOS app store.
If everything is configured correctly, you should be able to log in to the graphical desktop environment of your Kali Linux machine.
Troubleshooting Tips
XRDP Not Starting:
Check the logs for XRDP issues:
sudo journalctl -u xrdp
Black Screen After Login:
Ensure the correct desktop environment is selected in the RDP client.
Try installing and switching to a lighter desktop environment like XFCE.
Connection Refused:
Verify that the firewall or cloud provider security settings allow RDP traffic on port 3389.
Check the XRDP status to ensure it’s running.
Cover image attribution: https://pixabay.com/vectors/remote-desktop-preferences-lamp-97876/
Commentaires