I am trying to get started with raspberry pi, model B. As a way to avoid having to buy a monitor and hdmi cable and keyboard and mouse (no, I do not already have a tv, monitor, hdmi cable, usb keyboad and usb mouse), I am trying to use remote access through my laptop by connecting it to the router. I assigned fixed ip to raspberry pi by editing its cmdline.txt file. I can successfully ping it. (I am using raspbian). I can connect to it by using Xming and putty, well mostly. When I hit scratch, a program slowly loads, takes several seconds to fully draw the window. When I hit lxsession, I see a bunch of errors, but the raspbian desktop gets loaded but its empty. Why am I getting those errors? and Why is the desktop empty? Basically all I did was:

  1. burned the raspbian OS to sd card.
  2. Edited the cmdline.txt to append ip=xxx.xxx.xx (to match the same group as my computer's ip; I can ping my pie)
  3. Connect Rp to my home router using ethernet cable.
  4. install Xming and putty in my laptop and start them.
  5. Enable X-11 forwarding in putty, and login to raspberry pi's ip address from 2.
  6. try to load 'lxsession'

Is there anything missing? screen shot of error

  • I can barely see screenshot, if you're able to get scratch to appear on your computer what's your question? if you're worried about some output on your screen, you should take it to developers of that project, otherwise I'd say just ignore it.
    – alexus
    Apr 23, 2015 at 21:35
  • Full-sized screenshot: i.stack.imgur.com/0XwN2.png
    – Statement
    Nov 20, 2015 at 16:11

4 Answers 4


To do this simply:

  1. In PuTTY: go to Connection->SSH->X11
  2. Tick Enable X11 forwarding
  3. Change X Display location to -> localhost:0
  4. Run xming, connect to RPi with PuTTY
  5. In the shell, type startlxde

Make sure you have X dependencies installed correctly -

apt-get install lxde
apt-get install lightdm

These should drag in X and other dependencies if they are not there already. If you wish to start X from the command line using startx or xinit, you'll need:

apt-get install xinit

Usesudo raspi-config to boot to desktop.

Once you have your x-server running, you can install tightvncserver on Raspberry Pi

sudo apt-get install tightvncserver

Once you get your tightvncserver you can run it on your Raspberry Pi using

$tightvncserver :1

Note - :1 is display id (optional) Explore more options here

Once you have your vnc server running on your Raspberry Pi, you can use any vnc client on windows to connect remotely to your RPi.


ssh supports X11 "tunneling". This is useful because if the Pi (or any remote computer) requires traversing the Internet, you wont need to worry about opening up firewall ports or configuring NAT rules.

If you are not traversing a network where tunneling is needed, then you don't need to worry about ssh (more on that later). But since your question was about PuTTY & ssh I'll address that first.

If using PuTTY, you enable this by navigating to category

Connection -> SSH -> X11 and make sure you tick the box labeled "Enable X11 forwarding".

You also need to tell PuTTY where to find your local X11 server (this is the address of the Xming server). The default for this will be


X11 is a network-enabled display protocol.

The nomenclature here is


hostname can be any valid host or IP address.

Display is the X11 Display number (an integer) and usually this is '0'.

Screen is the screen number (an integer) on that display and also is usually '0' and can be omitted if the X11 Display only has one screen.

(For those using a Mac or Linux box and not using Putty, you can do X11 tunneling by including the '-Y' flag in your ssh command e.g. ssh -Y user@host).

This requests that the remote computer start an X11 forwarder. It will create a virtual X11 display that appears to run on localhost:10.0 (it will use "10" if it is the first ssh session with X11 forwarding. If another ssh client connects and also requests X11 forwarding then it will get localhost:11, and so on.

After you log into your Pi via PuTTY (or ssh command-line) verify that the DISPLAY environment is set:


You should see output like this:


Now run anything with a GUI ... such as galculator and verify that it displays.

galculator &

All of the above assumed you actually needed ssh tunneling of X11 (usually because you're traversing the Internet). If the Pi and your PC are on the same network (ports are not blocked) then you don't actually need to do anything special with ssh... just connect as you normally do.

BUT... you need to manually set your DISPLAY environment variable. This will be set to the hostname of your PC and the X11 server number.

export DISPLAY=<hostname>:0.0

Note that I used the X11 server & display numbers of :0.0 (and could have just used :0). This assumes you only have one Xming server running and it picks its default server number.

You may have a few more issues to deal with.

First, X11 has it's own security. It normally will only accept a local connection. To get it to accept remote connections you could either display disable access control completely (dangerous!) or you can add the hostnames (or IP addresses) to your X0.hosts file. This is usually C:\Program Files (x86)\Xming\X0.hosts (and you must be Administrator to edit it). Creating a specific list of permitted hosts is much safer than just switching off access control completely.

You may need to adjust Windows firewall rules to allow Xming to run and accept connections when on a private network (allowing this over a public network isn't advisable ... that's where ssh tunneling is a much safer option.)


If you are connecting to your home router, there is no need to add ip address in cmdline. Just go to your router panel and in DHCP Client List, note down the ip address of raspberrypi.

Now, run Xming.Then, use ip address of pi you got via DHCP client list in putty, port 22, enable x-11 in SSH and connect.

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.