I've got SSH access, and I have Xming installed, along with Xming fonts. I've configured PuTTY to forward x11 and told it to place the desktop at localhost:0, according to the instructions here.

However, after I log in, and startx, I get ... nothing. Or rather, it runs a bunch of messages which appear to say everything's working, but I get a cursor in my console window which acts like it's in a wait state. And that's it.

What am I missing? Do I need to open something to see the desktop?

I want to forward my desktop to my work PC, so that I can play with RasPi at lunch without physically plugging in the hardware. Please help.


Screenshot of what happens with Xming running, and I SSH in and call startx:

SSH with Xming response


This answer says startx is unnecessary, because it starts the RasPi X server, and I am using the Xming server on Windows. In that case, how do I get to the desktop/GUI on Xming from Windows? Because, even with Xming running, and SSH enabled, I don't get anything but a normal console prompt. Maybe I'm doing it wrong. What I want is my full, normal RasPi GUI running in a window on my remote Windows PC. I do not want to use VNC. I am forwarding over the Internet. How do I get there?

  • 2
    I also wanted to run graphical session from my Raspberry to my Windows Computer. And when i've seen your message saying that startx means start X server, i understood that i needed to start a X program... So let's start the the ... x-session-manager ! that way, you have the graphical session on your distant computer. thanks, you gave my the way !
    – user1297
    Commented Aug 27, 2012 at 19:08

3 Answers 3


If you start Xming on your Windows computer, then you already have an X server running. You don't have to start the X server of your Raspberry Pi using startx. Your X applications will run on the Raspberry Pi but the application will draw onto Windows' Xming X server.

The documentation you linked, states that you have to start X server on Windows, and it does not mention that you have to start X server on Linux. In the last sentence of the documentation:

You should now be able to run X applications from the host on your local desktop

"X applications" refers not to X server (which should be started by startx) but applications like xclock, xeyes, and so forth.

One special X application is lxsession which will start the standard session manager of LXDE (at least on my Raspbian). Starting this application on the console will give you the "full GUI" you are looking for:


Personally I don't find it useful to start lxsession, starting the X applications on the console is much easier for me.

  • 1
    Ok. This I can understand, I think. You're saying startx is unnecessary, because it starts the RasPi x server, and I am using the Xming server on windows. In that case, how to I get to the desktop/GUI on Xming from windows. Because, even with Xming running, and SSH enabled, I don't get anything but a normal console prompt. You're saying that I would only run the actual application in xming, not the full GUI. Maybe I'm doing it wrong. What I want is my full, normal RasPi GUI running in a window on my remote windows PC. I do not want to use VNC. I am forwarding over the internet.
    – zenbike
    Commented Aug 5, 2012 at 6:55
  • Works perfectly, if (as expected) a bit slow to respond. Thank you for your help.
    – zenbike
    Commented Aug 6, 2012 at 10:35
  • 1
    …And thats the reason your guide recommend running single apps over ssh at a time...
    – Alexander
    Commented Aug 28, 2012 at 7:09
  • 1
    @asalamon74 Thanks! Wow! this is just kickass. I don't have to deal with with the keyboard and the mouse connected to the usb with an insanely short wire. I used to sit infront of the tv with the above setup. NOW? I just ssh and run the gui like a boss!! Commented Mar 10, 2013 at 21:42

Using Cygwin/X

If you're not tied to Xming, you can instead use Cygwin/X for running an X server in Windows.

Preparing the Raspberry Pi

Try to establish a regular SSH connection from Windows to the Raspberry Pi using PowerShell:

Log in to Raspberry Pi on Windows with PowerShell and SSH

Given that Raspbian Buster includes X11Forwarding yes in /etc/ssh/sshd_config, your Raspberry Pi should also be able to forward the visual output of X11 applications to an X server on Windows.

The next step shows how to install that X server.

Install Cygwin/X on Windows

Cygwin/X provides an X server for Windows that displays GUI applications running on the Raspberry Pi.

  1. Download and run setup-x86_64.exe from Cygwin's website.

  2. For Cygwin's "Local Package Directory" you can use C:\Users\me\AppData\Roaming\Cygwin.

  3. Choose a server near you for downloading packages.

  4. Set "View" to "Full" and search for xinit.

  5. In the "New" column, use the drop-down menu to change the value from "Skip" to xinit's latest version:

Install package xinit with Cygwin

  1. Install package openssh the same way.

Connect to Raspberry Pi from Windows

  1. Start the X server using Windows' start menu: Cygwin-X → XWin Server. This won't open any windows, but you should see two new icons in your system tray:

XWin server icons in system tray

  1. Start the Cygwin terminal: Cygwin → Cygwin64 Terminal

  2. Set the DISPLAY environment variable to where the X server on Windows runs:

    export DISPLAY=:0.0

  3. Connect to your Raspberry Pi with X11 forwarding:

    ssh -Y pi@raspberrypi

Login with Cygwin Terminal

Inside the SSH session, you can now start an X application on the Raspberry Pi like Thonny:

Thonny forwarded to Windows

Alternatively, as user1297 mentioned in the question's comments, you can run x-session-manager to emulate the experience you'd get when connecting to the Raspberry Pi via HDMI on an external monitor:

Rasbpian desktop forwared to Windows

If you want to start an application directly without first typing its name in the shell, use this:

ssh -Y pi@raspberrypi x-session-manager

On macOS

XQuartz provides an X server for macOS.

Install XQuartz, log out and back in (to make the new value of DISPLAY effective), then launch applications with SSH from Bash:

ssh -Y pi@raspberrypi thonny

Thonny inside macOS using XQuartz


If you're already running an X server on Windows (as you are with Xming), then the Windows side is mostly done (but see below for a few important details). The key bit remaining is to tell the X11 apps on the pi to send their X11 data to your Windows PC.

This is done via the DISPLAY environment variable. Normally, if the X server and app are running on the same computer, DISPLAY will just specify the server number (e.g. :0 if you're only running one X server) or maybe a server and screen (e.g. :0.0). Since there is no IP address, this tells the apps' X library that the server is local and connections will be made accordingly (probably though some kind of shared-memory transport).

To tell the app to send X11 data to a remote node, include an IP address in the DISPLAY variable. For example, export DISPLAY= This will tell any X11 apps that they need to open a TCP connection to X server #0 on node DNS hostnames are fine here, if you've got them on your network.

Two potential problems

As I wrote in the first paragraph, simply running Xming may not be enough. There may be additional configuration necessary.

The first is that your X11 server must be configured to accept connections from remote nodes via TCP. Many X servers distributed today (I don't know about Xming) only accept connections from locally-running apps unless you explicitly configure them otherwise. This is a security feature, since every open socket is a potential vector for attack.

The second is that your X11 server maintains a database of hosts/users that are allowed to connect. You need to whitelist your Raspberry Pi's IP address. You can do this by running the xhost command from Xming on Windows, for example, from a console running in an xterm. You can also type xhost + to disable this security check, but that's dangerous because it will allow any app from anywhere in the world to open connections to your display. If you're behind a firewall on a LAN where you trust everybody (e.g. your own home), that's the easiest approach, but take the time to properly configure xhost if you're not.

Alternative: ssh -Y

Using the above approach, your X11 apps will all try to open TCP connections to your X server. These connections are not secure. Someone on your LAN snooping packets can intercept them.

To solve this problem, instead of setting the DISPLAY variable on the Raspberry pi, use the -Y parameter when connecting to it (e.g. slogin -Y hostname). The -Y parameter (like -X) will create a tunnel between the nodes for carrying X11 traffic. This will keep the X11 traffic encrypted and secure. It will also assign its own DISPLAY environment variable so apps will use the tunnel. It may also eliminate the need to mess with xhost since (as far as your X server is concerned) the connections are originating locally (from the originating side of the SSH tunnel).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.