Last Update: Jan 11, 2025

Coding with AI

I wrote a book! Check out A Quick Guide to Coding with AI.
Become a super programmer!
Learn how to use Generative AI coding tools as a force multiplier for your career.


Note: This article updated for the Raspberry Pi 5. I still prefer this over Raspberry Pi Connect.

Do you want to remote into your Raspberry Pi and see a graphical desktop? It’s really easy. If you don’t want to dedicate a monitor or the TV to the pi but still want to use it, here’s your solution.

Let’s say you’re like me and you have a bunch of computers around all the time. You have your Raspberry Pi that you want to play around with but you don’t want to fiddle back and forth with cables or hook it to your TV, well this method will let you have a graphical desktop on your own desktop of your PC or Laptop like this:

How to set up a remote desktop with Raspberry Pi

Pretty cool, right? Let’s get started.

Configure the Pi

Make sure your Pi is connected to the Internet, and your local network containing the other machines you want to connect with.

To set this up, you’ll need the Pi to run a service that your other computers can connect to. I’m using The Raspberry Pi OS with the desktop.

You can get it from the Raspberry Pi Imager:

How to set up a remote desktop with Raspberry Pi

I chose Xrdp for this, as I’ve had good experiences with it in the past. To install it in Raspian, you simply type:

sudo apt-get install xrdp

Then start it up and enable it:

sudo systemctl start xrdp
sudo systemctl enable xrdp

This is all you need to connect to the Pi. Xrdp will start up every time you start up your Raspberry Pi.

Next, make sure auto login is not enabled.

at the prompt, type in

sudo raspi-config

Go to System Options:

How to set up a remote desktop with Raspberry Pi

Select Boot / Auto Login

How to set up a remote desktop with Raspberry Pi

Make sure B3 is selected, Desktop GUI, requiring user to login

How to set up a remote desktop with Raspberry Pi

Now get your IP address

hostname -I

Remember this IP as you’ll need to use it to find your Pi from another machine.

You can connect via RDP with Windows, Mac, or Linux:

Connect to the Pi with Windows

You can connect to the machine from multiple environments; I suspect most beginners will be using a Windows system.

To start simply go to

Start -> All Programs -> Remote Desktop Connection

Put your IP address in the box:

How to set up a remote desktop with Raspberry Pi

And connect! You may see a message saying the remote computer cannot be verified like this:

How to set up a remote desktop with Raspberry Pi

You can safely ignore it. It comes up because your Raspberry Pi is running Linux, instead of Windows which is what remote desktop expects.

You should get the following screen next:

How to set up a remote desktop with Raspberry Pi

Log in, and you’re ready to go!

Connect to the Pi with Linux

If you want to connect to your Pi from Linux that’s equally easy.

I generally use rdesktop to connect. If you’re using Ubuntu or another Debian based installation, type in

sudo apt-get install rdesktop

After that installs, type in the following:

rdesktop < the IP address of your Pi >

You’ll see the familiar xrdp screen again.

If you are running a different distribution you can always build it from source, the latest version as of this writing is rdesktop 1.7.1 and it’s a pretty easy setup.

Additional Options

One thing you may notice is the Pi can go really high with it’s screen resolution, possibly higher than your monitor will allow. This will make it so you have to scroll around and end up with something like this:

How to set up a remote desktop with Raspberry Pi

Obviously not a great solution right? Well in Windows, you can adjust your resolution settings in Remote Desktop fairly easily. Click on the Options dropdown:

How to set up a remote desktop with Raspberry Pi

And select the “Display” tab:

How to set up a remote desktop with Raspberry Pi

You will see a slider with multiple options for resolution and color. Then go back to the General tab and click “save” to save your changes.

In linux you can pass some parameters to the command:

rdesktop -r 1024x768 < the IP address of your Pi >

and rdesktop will automatically resize to whatever resolution you want.

Why use RDP?

Someone may ask this, and it’s a valid question. If you’re running Linux and want to connect a Linux machine, why use a Microsoft protocol? The reason I suggest using xrdp is because it’s fast, stable and works well with multiple operating systems. There are several other VNC options you can use but for simplicity I chose this one, and it works well on both Windows and Linux machines.

Summary

I hope this has helped answer your questions about running your Pi as a virtual desktop. If you’re like me you might have your Pi stashed away somewhere and it’s more convenient to make it headless. For me it sits in my “datacenter” (the closet in my office) amongst other equipment, so when I want to play with my Pi, I either SSH into it or use RDP and it works great.

Till next time, keep sending me ideas and feedback!

Questions, comments? Let me know!


Want to learn more about the Raspberry Pi? Check out the Raspberry Pi for Developers course!



Stay up to date on the latest in Computer Vision and AI.

Get notified when I post new articles!

Intuit Mailchimp




Published: Dec 27, 2012 by Jeremy Morgan. Contact me before republishing this content.