NetSPI Blog

How to Remote Desktop to BackTrack 5 from Windows

Scott Sutherland
July 23rd, 2012


Managing BackTrack R2 via SSH is usually all you need. However, sometimes I like to manage BackTrack from Windows using X11 so that I can also have access to the desktop. In this blog, I’ll show you how to do the same using SSH, PuTTY, and Xming. This should be useful to penetration testers and BackTrack enthusiasts. The steps that will be covered are listed below:

  1. Setup SSH in BackTrack
  2. Disable the firewall (optional)
  3. Enable X11 Forwarding
  4. Restart SSH
  5. Export DISPLAY
  6. Install and Configure Xming
  7. Install and Configure PuTTY
  8. SSH to BackTrack
  9. Install and run gnome-session
  10. Access desktop in Xming

A Little Background on X11

Without going into any detail, X11 is a X Windows system that allows users to access GUI applications remotely. However, users should be aware that the terms client and server are inverted in the context of X11. Meaning that the system that makes the request to run an application on the remote server is referred to as the X11 Server, and the system providing access to the application is referred to as the client. So, server=client and client=server.

Setup SSH in BackTrack

Now that we have the X11 history out of the way, let’s get SSH enabled in BackTrack. SSH is installed by default, so only a few commands are needed to get things rolling. First, generate the keys that will be used by the server:

  • sshd-generate

Next, start the ssh daemon. By default is will start up on port 22:

  • /etc/init.d/ssh start

Finally, configure ssh to start and boot time:

  • update-rc.d ssh defaults

For those who don’t know. You can get the IP address of the system via the ifconfig. For the sake of this blog let’s assume that the BackTrack system’s IP is At this point I recommend verifing that you can actually connect to your BackTrack system via SSH. In use PuTTY in Windows or the stock ssh client.

Disable the Firewall

This section is NOT a requirement. However, some people like to go nuts and just drop their entire firewall if they are planning to get crazy. So if you feel your in the group, you can disable the default fire wall in Backtrack with the following IPTABLES commands:

  • IPTABLES -t nat -F
  • IPTABLES -t nat -X
  • IPTABLES -t mangle -F
  • IPTABLES -t mangle -X

Enable X11 Forwarding

Enable the following settings in the “/etc/ssh/ssh_config” file to enabled X11 forwarding.

  • ForwardAgent yes
  • ForwardX11 yes
  • ForwardX11Trusted yes

Restart SSH

Restart your SSH server or start it if it wasn’t running. Below is one option for restarting the service.

  • /etc/init.d/ssh restart

However, the Unbuntu community at large seems to prefer restarting services with the command below:

  • Service ssh –full-restart


Set the “DISPLAY” variable to the IP of your X11 server (Windows system). The basic syntax is below.

  • export DISPLAY=

If your Windows system is, then the command would be:

  • export DISPLAY=

Install and Configure Xming

Next, install the Xming X11 server.

  1. Download Xming from: Http://
  2. Follow the installation wizard.
  3. Double click Xlaunch icon.
  4. Choose “One window”.
  5. Click Next.
  6. Choose “Start no client”.
  7. Click Next.
  8. Click Next.
  9. Click Finish.
  10. Minimize the Xming window.

Install and Configure PuTTY

Next, install the full PuTTY package.

  1. Downlod the full .msi PuTTY install from:
  2. Follow the installation wizard.
  3. Enter the IP or hostname of the X11 client (BackTrack system).
  4. Under “Connection”, expand the SSH setting and select X11.
  5. Check the “Enable X11 Forwarding” check box.
  6. Enter “locahost:0.0” into the “X display location”.
  7. Click the Session Category.
  8. Click Save.

SSH to BackTrack

  1. Open PuTTY.
  2. Select saved session.
  3. Click open.
  4. Enter username.
  5. Enter password.

Install and Run gnome-session

You can install gnome-session with the following command.

  • apt-get install gnome-session

Once installed run the command below to send a gnome desktop to your Xming server.

  • gnome-session

Please be aware that you are not limited to the gnome desktop. I only chose it as an example because I’ve had success with it in the past. You can also run individual X applications like xterm, Firefox, etc by running the commands in your SSH sessions.

Access Desktop with Xming

Now all you have to do is open the Xming window and you should have desktop access waiting for you. Whooray for stuff!

Wrap Up

In closing, don’t feel like you have to be limited to the SSH console in BackTrack. I know it’s “Uber l33t”, but sometimes its nice to have desktop access too. As always, have fun, but don’t forget to Hack Resposibly.


Newest Most Voted
Inline Feedbacks
View all comments
peter mueller
peter mueller
7 years ago

Hello, many thanks, this works well !! Unfortunately I have a question: When leaving Putty/XLaunch, how can I reconnect back again to BT5 without loosing the old session ? regards kuzco1

7 years ago

You could also use x11vnc apt-get install x11vnc and then execute x11vnc -safer -nopw -once -display :0 or x11vnc -safer -nopw -once -viewonly -display :0 and then connect using vnc client Of course, without the security of SSH. Regards, Wilson

Dipin Prakash
Dipin Prakash
6 years ago

Hello..Thanks Scott..