Last Update: Jun 7, 2024

Today’s sponsor is Depot. Depot is a remote container build service that’s half the cost of GitHub Actions runners and up to 40x faster than other build services. Try it for free.

I recently added some new drives and hardware to my FreeBSD 13 server. I use this machine to run virtual machines for my courses and various experiments. I like to have a desktop handy to manage VirtualBox or perform other desktop tasks.

I could use Remote Desktop from Windows to access it, but I couldn’t remember how I set it up. The instructions available online aren’t super clear, so this time when I set it up, I documented it, and now I’m sharing it with you.

We’ll use XRDP to connect to a FreeBSD machine with RDP from Windows, Mac, or Linux.

Enable SSH

If you don’t already have it, the first thing you’ll need is SSH access. Log in under root.

Open up /etc/rc.conf (I use Vim, but you can use whatever editor you like)

vim /etc/rc.conf

Add the following line to /etc/rc.conf:


Then run the following to start up sshd:

/etc/rc.d/sshd start

Now you’ll be able to SSH into your machine, which is needed for remote desktop.

Installing xrdp

The xrdp package is awesome for setting up a remote desktop. With this app, you can set up RDP, VPN, or other connections easily. But it’s not always easy to configure with FreeBSD. That’s changed a lot over the years.

The latest version, with FreeBSD 13, is pretty straightforward.

To install it, as root type in:

pkg install xrdp

or if you prefer to build it from ports:

cd /usr/ports/net/xrdp/ && make install clean

Once that’s done, you’ll need to edit /etc/rc.conf again and add the following lines:


And then reboot your machine.

Configuring your Window Manager

If you connect now, you’ll go to Xterm. Not ideal. So if you open up /usr/local/etc/xrdp/ as root, you’ll see your options:

Remote Desktop FreeBSD

You can either uncomment one of these and save the file or create your own ~/ in your user folder. This is what I do so different users can have other desktops selected.

I’m using LDXE(meta) for my desktop, which isn’t listed here.

So I created a ~/ file and added the following line:

exec startlxde

and save the file. Now it’s ready to start up!

Starting up

So now you’ve rebooted, and you’re ready to go. You load up Windows Remote Desktop, put in your IP, and you’ll see this:

Remote Desktop FreeBSD

Which is normal if you don’t have a certificate set up. Next, you’ll be greeted with a login screen:

Remote Desktop FreeBSD

Here you enter your user credentials (not root!!).

And here’s my desktop!

Remote Desktop FreeBSD


I couldn’t find any step-by-step instructions for doing remote desktop in FreeBSD with LXDE, so I decided to document this. In the past, it’s been even more difficult, but now it’s fairly easy.

Now I can connect to my FreeBSD desktop from:

This allows me to jump on my FreeBSD desktop any time and do what I want. If you’re looking for the same experience, I hope this tutorial has helped.

Questions? Comments? Yell at me!

Published: Mar 10, 2022 by Jeremy Morgan. Contact me before republishing this content.