Home Kali Linux How to enable Remote Desktop and SSH access to Kali Linux

How to enable Remote Desktop and SSH access to Kali Linux

This guide will walk you through the process of setting up both Remote Desktop and SSH access on your Kali Linux system, allowing you to manage your system from afar. So, let's dive in and unlock the full potential of remote access.

by Abraham
guide to enabling remote access on kali linux

In today’s interconnected world, the ability to remotely access and manage your computer systems is paramount. Kali Linux, a powerful penetration testing platform, is no exception. Whether you’re a system administrator, a network engineer, or a security professional, having remote access capabilities can greatly enhance your productivity and efficiency.

This article will delve into the world of remote desktop and SSH access, specifically focusing on Kali Linux, the popular penetration testing and ethical hacking operating system. In this guide, we will explore the step-by-step process of enabling remote desktop and SSH access to Kali Linux, empowering you to harness the full potential of this renowned security-focused operating system. Enabling remote desktop and SSH access to Kali Linux enhances flexibility and facilitates collaboration, making it an invaluable tool for security professionals and enthusiasts.

By the end of this guide, you will have a comprehensive understanding of enabling remote desktop and SSH access on your Kali Linux machine.

Remote Desktop

Remote Desktop is a vital technology that allows users to access and control a computer system from a remote location. It enables users to interact with the remote computer’s graphical user interface (GUI) as if they were physically in front of it. Remote Desktop is widely used for various purposes, including remote support, accessing files and applications on a remote machine, and facilitating collaboration among team members. This feature provides convenience and flexibility, enabling users to access and manage their Kali Linux system from anywhere in the world. This section will explore setting up and enabling Remote Desktop access on Kali Linux.

How to set up and enable Remote Desktop access on Kali Linux

With remote desktop access, you can manage your Kali Linux machine from anywhere in the world, enabling flexibility and convenience. There are different methods to access the Kali system remotely:

1. Remote Desktop GUI Access

  • Windows Remote Desktop: If you are utilizing a Windows machine, you can utilize the built-in Remote Desktop Connection application to connect to your Kali Linux machine. Simply enter the IP address of your Kali Linux machine and provide your credentials to establish a remote desktop session.
  • VNC (Virtual Network Computing): VNC allows you to access the graphical interface of your Kali Linux machine remotely. Install a VNC server on your Kali Linux machine and use a VNC client application on your local machine to establish a connection.

2. Terminal or Text-Only Access using SSH

Secure Shell (SSH): SSH provides a secure and encrypted channel for accessing the command-line interface of your Kali Linux machine remotely. You can use SSH clients such as PuTTY or OpenSSH to establish an SSH connection to your Kali Linux machine. This method is particularly useful for remote administration and scripting.

Now that you are familiar with the remote desktop let us see how to setup and enable it on Kali Linux.

Note: We shall illustrate how to do this on a Kali Linux machine and a Windows Machine. Therefore, choose the suitable method from this guide depending on which machine you use as a host.

Using Kali Linux as a host machine

If you are using Kali Linux as a host to access another Kali Linux remotely, then follow this section:

1. Install a Desktop Environment

By default, Kali Linux comes with the Xfce desktop environment. If you haven’t installed a desktop environment yet, you can install Xfce using the following commands:

sudo apt update

sudo apt install kali-desktop-xfce
install xfce desktop

Install XFCE desktop

2. Install a Remote Desktop Server

We must install and configure a remote desktop server on Kali Linux to enable Remote Desktop access. One popular option is xrdp. Install it using the following command:

sudo apt update

sudo apt install xrdp
install xrdp

Install xrdp

3. Start the xrdp Service

After installation, start the xrdp service by running the following command:

sudo service xrdp start
start xrdp service

Start xrdp service

4. Enable the xrdp Service to Start on Boot

To ensure that the xrdp service starts automatically upon system boot, use the following command:

sudo systemctl enable xrdp
enable xrdp service at boot

Enable xrdp service at boot

5. Configure Firewall Rules (if applicable)

If a firewall is enabled on your Kali Linux machine, you must allow incoming connections to the Remote Desktop port. By default, xrdp uses port 3389. Use the appropriate firewall command to allow incoming connections to this port. For example, with ufw, you can run the following:

sudo ufw allow 3389
allow port 3389

Allow port 3389

6. Connect to Kali Linux via Remote Desktop

Once the setup is complete, you can connect to your Kali Linux machine using a Remote Desktop client application. On your local machine, open a Remote Desktop client and enter your Kali Linux machine’s IP address or hostname. Specify the port as 3389 if it’s not the default. Initiate the connection and provide your Kali Linux username and password when prompted.

login to another kali linux

Login to another Kali Linux

Upon successful authentication/login, you will be connected to the Kali Linux desktop remotely, allowing you to interact with it as if you were physically present.

remote desktop connected successfully

Remote desktop connected successfully

Note: It is crucial to ensure the security of your Remote Desktop connection. Consider using a secure connection method such as VPN, implementing strong passwords, and keeping your system updated with security patches.

Enabling Remote Desktop access on Kali Linux provides users with the flexibility and convenience of remotely managing their Kali Linux machine’s graphical interface. This capability is particularly useful for scenarios such as remote administration, collaboration, and accessing Kali Linux resources from a different location.

Using a Windows computer as a host machine

If you are using a Windows PC as a host to access a Kali Linux PC remotely, then follow this section:

To enable Remote Desktop on a Windows machine, follow these steps:

  1. Open the Start menu, search for “Remote Desktop settings,” and select the “Remote Desktop settings” option from the search results.
    open remote desktop settings

    Open Remote Desktop Settings

  2. In the System> Remote Desktop, toggle on the off button under “Remote Desktop” as shown in the image below:
    toggle on remote desktop connection

    Toggle on Remote Desktop connection

  3. Under the Remote Desktop section, select “Allow remote connections to this computer.” If you are using Windows 10, you may also have the option to choose between allowing connections from only computers running Remote Desktop with Network Level Authentication or from any version of Remote Desktop.
    allow connections with or without network level authentication

    Allow connections with or without Network Level Authentication

  4. Click on the “Remote Desktop Users” button to configure additional settings if needed. Here, you can specify whether to allow connections only from specific users or groups, choose which version of the Remote Desktop protocol to use, and configure other options.
    configure remote desktop users

    Configure Remote Desktop Users

  5. Click the “OK” to save the changes.
    click ok button to save changes

    Click Ok button to save changes

Once Remote Desktop is enabled on the target Kali Linux machine, you can connect to it from another computer using a Remote Desktop client software. Follow these steps to establish a Remote Desktop connection:

  1. On the remote computer( Windows OS), open a Remote Desktop client software. You can use applications like Remmina, Vinagre, or any other Remote Desktop client that supports the Remote Desktop Protocol (RDP). But in this case we shall use the built in Remote Desktop connection
    open remote desktop connection

    Open Remote Desktop Connection

  2. In the Remote Desktop client software, enter the IP address or hostname of the target Kali Linux machine you want to connect to. You may need to specify the port number if the target machine uses a non-default port for Remote Desktop. By default, Kali Linux uses port 3389 for Remote Desktops.
    enter remote desktop ip address

    Enter Remote Desktop IP address

  3. Click the “Connect” or “Connect Remote” button to initiate the connection.
    click connect

    Click Connect

  4. You will be prompted to type in the password and username of an account with permission to access the remote Kali Linux machine. Enter the credentials and click “OK” or “Connect” to proceed.
    input credentials

    Input credentials

  5. If the connection is successful, you will see the remote desktop of the target Kali Linux machine displayed in a window on your local computer. You can now interact with the remote desktop as if you were sitting in front of the remote machine.
    access kali remotely from your windows os min

    Access Kali Remotely from your Windows OS

Note: Ensure the target Kali Linux machine has Remote Desktop enabled and is accessible from the network. If you are connecting to the Kali Linux machine over the internet, ensure that you have appropriate network configurations, such as port forwarding, to allow Remote Desktop connections.

It is worth noting that Remote Desktop functionality may vary depending on the operating system and edition of Windows you are using. Additionally, ensure that the target machine has network connectivity, is powered on, and is not blocked by firewalls or network restrictions.

Establishing a Remote Desktop connection to a Kali Linux machine allows you to control and manage the graphical interface of the remote machine from a different location. This feature is useful for tasks like remote administration, accessing applications and files, and collaborating with others on the Kali Linux system.

Remote Desktop provides a convenient way to access and control a computer remotely, making it an essential tool for remote work, IT support, and other scenarios where remote access is required.

Setting up Remote Desktop Access on Kali Linux

Remote desktop access enables users to remotely control their Kali Linux machine’s graphical interface, facilitating ease of use and efficiency. To enable remote desktop access, follow these steps:

Step 1: Install a Desktop Environment (Optional)

By default, Kali Linux uses the Xfce desktop environment. If you haven’t installed a desktop environment yet, use the following commands to install Xfce:

sudo apt update

sudo apt install kali-desktop-xfce
install xfce desktop

Install XFCE desktop

Step 2: Install and Configure VNC Server

We will utilize the Virtual Network Computing (VNC) protocol to enable remote desktop access. Install the VNC server package using the following command:

sudo apt update

sudo apt install tightvncserver
install vnc server

Install VNC server

After installation, configure the VNC server by executing the following:

vncserver

You will be prompted to set a password and choose a VNC server profile.

launch vnc server

Launch VNC server

Step 3: Establish a Secure Connection

We will use an SSH tunnel to establish a secure connection to the VNC server. Open an SSH session to your Kali Linux machine using the following command:

ssh -L 5901:127.0.0.1:5901 -C -N -l username kali-linux-ip-address

Replace “username” with your username and “kali-linux-ip-address” with the IP address of your Kali Linux OS.

Example:
ssh -L 5901:127.0.0.1:5901 -C -N -l fosslinux 192.168.100.30
establish a secure connection

Establish a secure connection

Note: If you are encountering any challenges with SSH connection, skip to the next section where we cover in detail how to enable SSH access.

Step 4: Connect to the Remote Desktop

Once the SSH session is established, use VNC viewer software (e.g., RealVNC, TightVNC) on your local machine to connect to the remote desktop. Enter “127.0.0.1:5901” as the VNC server address and provide the password you set earlier.

Enabling SSH Access

SSH (Secure Shell) access allows users to securely connect to a remote Kali Linux machine and execute commands remotely. Here’s how you can enable SSH access:

Step 1: Install OpenSSH Server

Install the OpenSSH server package on your Kali Linux machine by running the following command:

sudo apt update

sudo apt install openssh-server
install open ssh server

Install openssh-server

Step 2: Enable Kali Linux Remote SSH Service

After installing the OpenSSH server, it needs to be started and set to start automatically on boot. Perform the following steps:

  • Start the SSH service:
sudo service ssh start
start ssh service

Start ssh service

  • Enable the SSH service to start on boot:
sudo systemctl enable ssh
enable ssh at boot

Enable ssh at boot

Step 3: Change Kali Default SSH Keys to Avoid MITM (Man in the Middle) Attack

By default, Kali Linux uses generic SSH keys, which can make it vulnerable to Man-in-the-Middle (MITM) attacks. It is highly recommended to change the default SSH keys to enhance security. Follow these steps to generate new SSH keys:

  • Generate new SSH keys:
sudo ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa sudo ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa sudo ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa sudo ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
  • Restart the SSH service to effect the changes:
sudo service ssh restart
restart ssh service

Restart SSH service

Step 4: Set MOTD (Message of the Day) with a Nice ASCII

The Message of the Day (MOTD) is displayed when you log in via SSH and provides useful information or a customized welcome message. You can personalize your Kali Linux MOTD using ASCII art or displaying system information. Follow these steps to set up a customized MOTD:

  • Edit the MOTD file:
sudo nano /etc/motd
edit message of the day

Edit Message of the day

  • Save your desired ASCII art or system information to the file.
Step 5: Change SSH Server Port for Safety

Changing the default SSH port adds an additional layer of security to your Kali Linux machine. Follow the steps provided herein to change the SSH port:

  • Edit the SSH server configuration file:
sudo nano /etc/ssh/sshd_config
edit ssh configuration file

Edit SSH configuration file

  • Locate the line that specifies the SSH port (default is Port 22) and modify it to your desired port number.
  • Save the file. Once done, restart the SSH service:
sudo service ssh restart
restart ssh service

Restart SSH service

Step 6: Configure the SSH Server

To customize the SSH server’s behavior, you can modify the configuration file located at /etc/ssh/sshd_config. Ensure the following settings are correctly configured:

  • Port: Set a custom port number if desired (e.g., 2222).
  • PermitRootLogin: Disable root login for enhanced security.
  • PasswordAuthentication: Enable or turn off password-based authentication, depending on your requirements.
  • AllowUsers: Specify the users allowed to connect via SSH.
Step 7: Restart the SSH Server

After modifying the configuration file, restart the SSH server to apply the changes:

sudo service ssh restart
restart ssh service

Restart SSH service

Step 8: Troubleshooting

In case you encounter issues with remote desktop or SSH access, here are some troubleshooting tips:

  • Check firewall settings: Ensure that the necessary ports (3389 for remote desktop and 22 for SSH) are open in your firewall configuration.
  • Verify network connectivity: Ensure that your Kali Linux machine and the remote machine are connected to the same network or that appropriate routing is configured.
  • Check SSH configuration: Double-check the SSH server configuration file (/etc/ssh/sshd_config) for any misconfigurations or typos.
  • Restart services: If everything fails, try restarting the relevant services (xrdp for remote desktop, ssh for SSH) on your Kali Linux machine.
Connect to the Kali Linux Machine via SSH

From a remote machine, open an SSH session to your Kali Linux machine using the following command:

ssh username@kali-linux-ip-address

Replace “username” with your username and “kali-linux-ip-address” with the IP address of your Kali Linux machine.

Example:

ssh rutto@192.168.100.6
connect to another kali linux via ssh

Connect to another Kali Linux via SSH

Security Considerations

While enabling remote desktop and SSH access to Kali Linux can greatly enhance flexibility and productivity, it’s essential to prioritize security. Here are some additional security considerations to keep in mind:

  1. Use Strong Passwords: Ascertain that all user accounts, including the ones used for remote access, have strong and unique passwords. Consider implementing two-factor authentication for an extra layer of security.
  2. Limit SSH Access: Review and update the SSH server’s configuration to restrict access to specific IP addresses or a limited range of IP addresses. This helps mitigate the risk of unauthorized access.
  3. Implement SSH Key-Based Authentication: Consider using SSH key-based authentication instead of password-based authentication. SSH keys provide stronger security and eliminate the risk of password brute-forcing attacks.
  4. Regularly Update Software: Keep your Kali Linux system and all installed software up to date. Regularly applying security patches and updates help protect against known vulnerabilities.

Conclusion

Enabling remote desktop and SSH access to Kali Linux expands your capabilities as a security professional or Linux enthusiast. In this guide, we have explored the step-by-step process of setting up remote desktop and SSH access, allowing you to control your Kali Linux machine from anywhere in the world. Following the steps provided in this article guide, you can seamlessly connect to your Kali Linux machine from anywhere, empowering you to perform tasks, manage systems, and troubleshoot issues remotely. The ability to access your machine securely and conveniently not only saves time and effort but also enhances your productivity and flexibility. Now that you have gained a comprehensive understanding of remote desktop and SSH access go ahead and unlock the full potential of your Kali Linux system.

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.