How To Remote Access Kali Linux


Kali Linux is typically the kind of distribution for which remote access is pretty useful. You can leave it running, somewhere on the network, and access it remotely to use of the many tools available. But unfortunately, nothing is enabled by default, so you have to configure a few things before using remote access on Kali Linux.

SSH, VNC and XRDP are installed by default on a fresh Kali Linux installation, but they are not enabled. The services need to be started first, before Kali Linux could be accessed from another computer.

Let’s see how to enable these services (I’ll also explain what they are if you have never seen those abbreviations). Then, I’ll show you how to use them from your computer.

How To Enable Remote Access On Kali Linux

Kali Linux comes with a few applications pre-installed for remote access, like VNC and SSH. But they are not configured by default. You first need to start the service before using them.

SSH

SSH stands for “Secure SHell”, and will be the easiest way to get access to the command line of Kali Linux from another computer on the same network.

SSH is pre-installed on Kali Linux, but you need to start the service to make it accessible.
Open a terminal and type this command:
sudo service ssh start

Once the service is started, it will show “Active” in the status. You are ready to use it.
Check the end of this article to know how if you are new to this.

But if you want to have access to the full desktop environment from another computer, you should try the two next options. Even if most tools are available in command line on Kali Linux, it might be easier to use them with the full interface.

Note: The services listed in this article won’t start automatically on boot. You have to do it manually each time, or tell Kali Linux to enable them. Here is the command for the SSH service:
sudo systemctl enable ssh
You can use the same syntax for the other services listed below.

XRDP

XRDP is a free remote access protocol, base on the Microsoft Remote Desktop protocol. It allows you to open a new session on the remote server, as if you were using the computer directly.

It’s a popular protocol, with tools available on any operating system and distributions, so it’s probably the easiest way to remote access Kali Linux from another computer.

XRDP is also installed by default on Kali Linux, you just need to start the service before using it:
sudo service xrdp start

Don’t forget to enable the XRDP service on boot if you restart your Kali Linux computer regularly.
And check the end of this article where I explain how to use XRDP.

VNC

VNC is another famous protocol for remote access. It’s also pre-installed on Kali Linux, but you need to set a password before using it.

The difference with XRDP is that XRDP will start a new session (you’ll type your login and password), while VNC just take over the current opened session, you just need a VNC password to access it.

Typically, VNC is generally used for tech support, so that the IT guy can access the current user session, and see the problem, while fixing it with the PC user seeing everything.

To create the password, you just need to use this command:
vncserver
On the first run, you will be asked to provide a password (8 characters max). It will also give you the URL to access the session (infosec-kali:1 in my example).

Unfortunately, it seems that VNC is not that easy to automatically start on boot on Kali Linux. I already used it on other distributions, but I could find a way to make it work on the latest Kali Linux version available.

The most probable solution is to follow this guide on Superuser.com. I didn’t test, but I think it should work. It’s pretty complicated though, so only do it if it’s really mandatory in your situation. You can still enable SSH and start VNC from there each time if needed (or use XRDP).

Once VNC enabled, you can connect to it (read the following section to know how if you need some help here).

Ethical Hacking Course
Learn Ethical Hacking From Scratch
Become an ethical hacker that can hack computer systems like black hat hackers and secure them like security experts.

More details

How To Remote Access To Kali Linux

Here are the required steps to remote access Kali Linux:

  • Get the current IP address of Kali Linux.
  • Choose a remote access protocol (SSH, XRDP or VNC).
  • Use the corresponding tool on your computer.

Let’s see how to do this.

Get the Kali Linux IP address

The first thing you’ll need is to know the current IP address of your computer running Kali Linux.
Sometimes you can use the host name (infosec-kali on my screenshots), but most of the time the IP address will be more stable.

If you have access to the desktop interface, you can do a right-click on the network icon in the top bar. Then click on “Connection information”. A window like this will show up:

The IP address is mentioned under “IPV4”. In my example, it’s 172.24.27.195.
It will probably be something like 192.168.1.X or 192.168.0.X in your case.

If you only have terminal access, or want to use the command line, you can try:
ifconfig

The IP address is mentioned on the second line, corresponding to the interface you are currently connected with (Ethernet ⇒ eth0, Wi-Fi ⇒ wlan0).

Whatever method you use, take note of the IP address, you’ll need it later to access your Kali Linux session.

Choose one protocol

Before going further, just pick on protocol among all the ones we have seen.
Here are the one I recommend, in this order:

  • XRDP: you probably already have everything you need on your computer to use it. We have enabled the service, so it’s ready to use.
  • SSH: if you are comfortable with the command line, it’s the most lightweight solution. Probably nothing to install on your computer if you have Windows 11 or Linux/macOS.
  • VNC: Only if you only need to see the current screen on the computer, or maybe to keep heavy applications running for a long time without closing the session if you quit.

Just pick one, try it, and you can always change your mind if it’s not a good fit.

Use the right tool

Once the services enabled and the protocol chosen, it’s time to access Kali Linux remotely.
Here is how to do it for each solution.

SSH

Once SSH enabled, you can access Kali Linux from a terminal on your other computer.
The command syntax is:

ssh <username>@<ip_address>
So, for example:
ssh pat@172.24.27.195

On Windows, the terminal is named “Command prompt”. You’ll find it in the start menu (use the search engine).
If you have an old version of Windows, the ssh command might not work. In this case, you’ll need to install a client and use it. Most of the time, Putty is recommended to do this.

Once connected, you have access to all the commands available on Kali Linux.
You can for example follow my tutorial to use some network capture commands, or use Hashcat directly from your computer.

XRDP

The second option, if you need access to the desktop interface, is to use XRDP.

On Windows, the “Remote Desktop Connection” tool is installed by default. You’ll find it in the start menu, it looks like that:

Just type the IP address and click on “Connect”.
On Linux or macOS, you also have similar tools installed. On a lite distribution, you might need to install them manually. Remmina is a good one for example.

Once connected with any RDP tool, you’ll have to log in:

Use the same username and password as when you sign in on Kali Linux directly.
Once done, you should get access to the full desktop interface:

From there, you can do everything as if you were directly on the computer. All applications will work, and obviously, you can also use the terminal if needed.

By the way, XRDP will open a new session, so you might have an issue if the session is already opened on the remote computer (a gray screen typically). I experienced this problem during my tests.

If it’s the case, you need to edit the XRDP startwm.sh script to reset the existing session.
Open the file with Nano:
sudo nano /etc/xrdp/startwm.sh
Add these lines at the beginning:
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR

Here is what the file should look like:

Save the file and restart the connection. It should work correctly after that (reboot the computer if not, but I think it worked directly).

VNC

Finally, if you really want to use VNC, you’ll need to do a few things beforehand.

First, you need a VNC client on your computer. Many options are available, but there are some proprietary reasons that make not of them compatible with Kali Linux.
The best option, in this case, is to use TightVNC. You can download it from here.
It’s free and available on any operating system.

Once installed, you can’t use it directly. You’ll get a similar issue as with XRDP.
XFCE (the desktop environment) won’t start automatically, and you’ll get a gray screen in VNC.

Here is how to fix this:

  • Open a terminal or SSH connection.
  • Edit this file:
    nano /home/<username>/.vnc/xstartup
  • Add these lines at the beginning:
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    startxfce4 &

Once done, it looks like that:

Back to your computer, type the URL give by the “vncserver” command you used earlier to start the service. In most cases, it will be something like “IP_ADDRESS:1”.
Don’t forget the end, the IP address won’t work.

You’ll then need to type the password you created the first time you used “vncserver”, and should get access to the full interface:

As with XRDP, you can now use the full desktop interface.

Just remember that, unlike with XRDP, the screen will be active on the remote computer, and if there is one screen plugged, everybody passing in front of the screen will see what you are doing, and can even use the mouse/keyboard to interact.

Don’t forget to close the session when you quit :-).

Want to learn more about Kali Linux, here are a few interesting tutorials for you:

Pat

Hi, my name is Patrick, I'm a web developer and network administrator. I have always been interested in security, and I created this website to share my findings with you.

Recent Posts