Last Update: Jan 5, 2023
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.
If you don’t already have it, the first thing you’ll need is SSH access. Log in under root.
/etc/rc.conf (I use Vim, but you can use whatever editor you like)
Add the following line to
Then run the following to start up sshd:
Now you’ll be able to SSH into your machine, which is needed for remote desktop.
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/startwm.sh as root, you’ll see your options:
You can either uncomment one of these and save the file or create your own
~/.startwm.sh 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
~/.startwm.sh file and added the following line:
and save the file. Now it’s ready to start 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:
Which is normal if you don’t have a certificate set up. Next, you’ll be greeted with a login screen:
Here you enter your user credentials (not root!!).
And here’s my desktop!
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!