Tuesday, 23 October 2012

How to Setup Remote Desktop from a Windows Machine to your Raspberry Pi - Step by Step Guide

As I mentioned in the previous post I recently found the need to be able to remote desktop to my Raspberry Pi.  This is a step by step guide on how to set it up.

What does this guide help me do?


It will let you control your Raspberry Pi from another machine.  Meaning that the Raspberry Pi will not need to be connected to a monitor, keyboard or mouse.

Before we get started a few clarifications:

  • This guide is to set up remote desktop from another computer on your home network to your Raspberry Pi. 
  • It does not explain how to connect to your Pi from outside your home network.
  • The instructions are for connecting from a windows machine.

What do I need before I get started?

  1. A Raspberry Pi running the latest Raspbian “wheezy” image (at time of writing 2012-09-18-wheezy-raspbian.zip).  It should work with other Linux versions too, but that is the one I have tested with.
  2. The Raspberry Pi should be connected to your home network and have a internet connection.
  3. A second machine running windows that you want to use connect from which is connected to the same home network.

The Steps


Raspberry Pi Setup


So first we need to install some software on the Raspberry Pi, but don't worry it is very easy!
  1. Start up your Pi to the terminal prompt. 
  2. Type the following command "sudo apt-get install xrdp"
  3. If promoted enter your password (the default is "raspberry")
  4. Type "Y" and press enter.
  5. This is now installing xrdp onto your Pi which is the software we are going to use for the remote desktop connection.  Wait for it to complete.
  6. Restart your Pi.  We are going to check that xrdp is going to start up automatically.
  7. When your Pi has booted to the command prompt look for [ ok ] Starting Remote Desktop Protocol server : xrdp sesman.  This shows you that xrdp is installed and automatically starting up on start up of your Pi
  8. The last step is to make a note of the IP address of your Pi which should also be displayed on the start up screen.  In my case below it is 192.168.1.9.  This is the address of your Pi on your network and what we will use to connect to your Pi from the second machine.

Second Machine Setup


1. Launch Remote Desktop Connection which can be found at Start->All Programs->Accessories->Remote Desktop Connection
2. Type in the IP Address for your Pi which you noted above.

3. Click Connect (you may get a security warning at this stage just click OK if you do.  After all it is your Pi on your network so nothing to worry about security wise).
4. Leave the Module on the default of sesman-Xvnc and enter your username and password for your Pi.  (The default is pi and raspberry if you haven't changed them).

5. Click OK and after a few moments you should be greeted my your Raspberry Pi's desktop!

6.  When you are finished simply log-out from the Pi's desktop.







45 comments:

  1. Thanks for the walkthrough. I'll give this a try when I'm home later. What resolution will be used? Can this be changed?

    ReplyDelete
  2. Replies
    1. Isvar - Yes. You can download it here http://www.microsoft.com/mac/remote-desktop-client
      Although purists will hate the idea of connecting from a Mac to Linux via Microsoft technology. I was going to include instructions as part of this guide, but for some reason this morning I couldn't get it working on my Mac, so pulled that section in favor of actually getting this posted. But I have had it working in the past.

      Delete
    2. Cord has worked well for us.

      http://cord.sourceforge.net/

      Delete
  3. Daniel - Mine defaulted to full screen. When you enter your IP address if you click the options button, then there is a display tab which let's you change the resolution. I will have to test to see if it works though.

    ReplyDelete
    Replies
    1. Ok, so the resolution is specified by the connecting client, not any LXDE config on the RPi?

      Delete
    2. From my experiments this morning it would appear so, yes. So I can connect from my netbook and get full screen; I can also connect from my laptop which has a bigger display and get full screen. Then changing the resolution on the Remote Desktop Connection settings tab, brought the Pi up in a 640 x 480 window.

      Delete
  4. I get a " connecting to sesman ip 127.0.0.1 port 3350" window that just stays in place until I zap it.

    ReplyDelete
    Replies
    1. Tim - Did you start with a clean Raspbian “wheezy” image or have you got other software already installed on there? What version of Windows are you using?

      Delete
  5. Just given it a go and this works fine thanks. Although don't forget this is Linux, not Windows, so a restart isn't required (I didn't do one). You can find your IP address with ifconfig.

    ReplyDelete
  6. Please explain why I need a "clean Image". Am I going to have to wipe out my installs each time I try something new?

    BTW, the startx still goes to the monitor. Why can't I set DISPLAY=.....?

    ReplyDelete
    Replies
    1. It was just a question... I'm afraid I am no expert on xrdp, I just wanted to share what I had done. My thought was that with a clean image you have the exact same setup on the Pi that I did and if it still doesn't work you can start looking for problems elsewhere.

      For me the fact I can just wipe back to a clean install is one of my favorite features of the Pi and something I intend to do often. But I guess it depends what you are doing with it.

      "BTW, the startx still goes to the monitor. Why can't I set DISPLAY=.....?" - I'm not sure what you mean by this bit, sorry. I've disconnected the monitor from my Pi now.

      Delete
    2. how dare you......... Thank you

      Delete
  7. Followed this procedure this morning and worked without a flaw. Worth mentioning for newbies like me that Raspian Wheezy includes a running SSHD service.

    So it's possible to connect from Windows using Putty or Cygwin/OpenSSH to get to a command line prompt - you don't need to purchase a USB keyboard/mouse or attach to a display device.

    Just use the default username/password of pi/raspberry.

    ReplyDelete
  8. Thanks a lot, its very easy to follow your step by step process

    ReplyDelete
  9. Thanks for the uncomplicated explanation.

    ReplyDelete
  10. Thanks you this was helpful.

    ReplyDelete
  11. This RDP based solution works a lot better than X-windows tunelling (even compressed) to Xming and displays better than with TightVNC+UltraVNC. I may now think about buying another ARM: Samsung GoogleChrome and connect with RDP to Windows, Mac, RasPI and Linux servers from this light terminal... Need just to be sure that Google will not be archiving all my communications !

    ReplyDelete
  12. Thanks for the entry.

    I've done everything as you explain, but i´m allways having a "login failed" massage when i try to connect from W7. Any clue?

    Thanks

    ReplyDelete
    Replies
    1. Have you changed the username or password on your Pi?

      Delete
    2. Yes, I did and that was the problem.

      Finally, I solved it changing it again to raspberry. I tried again and I could connect. After that, I changed it again and now I can connect with the new one.

      I think that the problem was I changed the password using the raspi-config utility the first time. Second time I did it using a terminal.

      Thanks a lot for your guide and for your quick answer

      Delete
  13. Thank you for this blog page.
    Followed the instructions and they worked first time.
    Paul

    ReplyDelete
  14. Thank you for this. From an android device, use a remote app (e.g. AccessToGo ) to connect to the RPi =>http://goo.gl/HKIxp

    ReplyDelete
  15. Thank you for this.

    I just got my Pi working and didn't bother with a separate keyboard and screen.

    I tried this with Xming but am more familiar with RDP. The downside is I have to install the RDP server. It works a treat.

    How would I go about uninstalling the RDP server from the Pi?

    ReplyDelete
  16. How it is possible to define international or national keyboard when using Windows(7) Remote desktop? Pi seems to use US keyboard mapping as default. I have Finnish keyboard and it works fine when I connect using USB port.

    ReplyDelete
    Replies
    1. Have you set your keyboard layout in RasPi Config? http://elinux.org/RPi_raspi-config

      Delete
  17. I have XBMC installed and it boots into that when i turn on my RPi. Im guessing i need to stop it doing this and instead boot into xrdp (which perhaps explains the fact im getting "no hom/pi/.xsession file" error messages after log in.

    How do I do this and as my wife uses the RPi for XBMC (and is less teccy than me!) how do I go about reverting back to it booting into that when i need it to?

    Any help appreciated!

    ReplyDelete
    Replies
    1. I'm afraid I don't know a great deal about XBMC. Did you install it on top of Rasbian?

      My personal solution would be buy a second SD card and just put the standard Rasbian image on that. IMHO this is one of the biggest strengths of the Pi, it can actually be multiple computers each with its own specific task and you can switch between them just by changing the SD card.

      Delete
  18. Can you tell me if the inverse is possible? I'd like to control my windows PC using Raspberry...

    ReplyDelete
  19. Nice, simple instructional....appreciate it. Worked as written. It is fantastic. Thanks!!!

    ReplyDelete
  20. Can i use RJ-45 straight cable between PI and Windows PC ?

    ReplyDelete
  21. Ah...thank you!!! So much better to remote in. Just what I needed!

    ReplyDelete
  22. If you want to access your Pi from internet , you just have to forward the Port 3389 on your router, to your Raspberry Pi module.
    Regards

    ReplyDelete
  23. Got this working but..
    When running Scratch through xRDP as soon as a program is run the Pi freezes completely. This happens both with a Windows box and using iRDPAV on an iPad. Mesage on Pi is " Unable to handle kernel paging request..."

    Any idea?

    ReplyDelete
  24. The commonplace issue gamers' experience is warming up of the computer case. At the point when the case is completely worked out, it is inescapable that the segments inside will warm a little because of preparing activities. To oblige this issue, the gamer must have a case that capacities as per his needs. Best all in one computer 2019

    ReplyDelete
  25. Yeah, remote desktop could be an awesome feature. Remote office Backup could be useful in case you own a remote office.

    ReplyDelete
  26. Thanks for sharing such beautiful information with us.
    I hope you will share some more info about Remote Desktop.
    Professional Remote Desktop Provider

    ReplyDelete
  27. Great job for publishing such a nice article. Your article isn稚 only useful but it is additionally really informative, thanks for this and if anyone want to buy cheap admin rdp in usa at affordable price, visit here Adminrdp.com

    ReplyDelete
  28. Hi Adam, thanks for the guide!
    I've published an up-to date guide on using RealVNC with Windows to access a Raspberry Pi here:

    https://picockpit.com/raspberry-pi/how-to-use-realvnc-on-a-raspberry-pi-remote-desktop/

    Maybe someone will find it useful :-)

    ReplyDelete
  29. Awesome blog. I enjoyed reading your articles. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!tableau automation

    ReplyDelete
  30. Awesome blog! but is possible use rdp out my local, for example, can i connect to my rasperry pi if im in another wifi?

    ReplyDelete
  31. This piece of writing is in fact a nice one it assists new web viewers, who are wishing for blogging. 토토

    ReplyDelete