Skip to main content.

Jailed VNC sessions

2013-10-09

Live demo in BSD Now Episode 006 | Originally written by TJ for bsdnow.tv | Last updated: 2013/10/09

NOTE: the author/maintainer of the tutorial(s) is no longer with the show, so the information below may be outdated or incorrect.

Have you ever needed to run a specific GUI application on your BSD system.. securely? Remotely? Well, if you follow this tutorial, you can! We'll be running a VNC server, patching it to work in a FreeBSD jail and only allowing VNC over a tunneled SSH connection. The patch has been submitted upstream but both the developers and port maintainers don’t seem to care about integrating it. I’m going to install X11, a light window manager (Openbox) and TightVNC. You can replace Openbox with whatever window manager you like. This assumes you already have a jail with an sshd running and the ports tree in place.

## If you don't have portmaster, install it from /usr/ports/ports-mgmt/portmaster

# portmaster -d --no-confirm x11/xorg x11-wm/openbox net/tightvnc
# fetch -o /tmp http://www.bsdnow.tv/patches/vncserver.patch
# sha256 -q /tmp/vncserver.patch

7233241911c254c75ac0b19b454fbad1a8837934023b31ca4df3b43da860448f

# cd /usr/local/bin
# patch < /tmp/vncserver.patch

Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- vncserver  2013-10-09 16:10:25.000000000 +0000
|+++ vncserver.new      2013-10-09 16:12:45.000000000 +0000
--------------------------
Patching file vncserver using Plan A...
Hunk #1 succeeded at 296.
Hunk #2 succeeded at 304.
done

We'll add some items to start up automatically.

$ mkdir ~/.vnc
$ vi ~/.vnc/xstartup

Put your window manager and a terminal and whatever else:

#!/bin/sh
xrdb $HOME/.Xresources &
openbox &
xterm -bg black -fg gray &

Finally,

$ chmod +x ~/.vnc/xstartup
$ vncserver -depth 24 -geometry 1280x800 -nolisten tcp :1

Now, on the client PC we run:

$ ssh -v -N -L 5901:localhost:5901 you@your-server-ip

And use any VNC client to connect to localhost, port 5901.

Latest News

New announcement

2017-05-25

We understand that Michael Dexter, Brad Davis, and George Rosamond think there should be more real news....

Two Year Anniversary

2015-08-08

We're quickly approaching our two-year anniversary, which will be on episode 105. To celebrate, we've created a unique t-shirt design, available for purchase until the end of August. Shirts will be shipped out around September 1st. Most of the proceeds will support the show, and specifically allow us to buy...

New discussion segment

2015-01-17

We're thinking about adding a new segment to the show where we discuss a topic that the listeners suggest. It's meant to be informative like a tutorial, but more of a "free discussion" format. If you have any subjects you want us to explore, or even just a good name...

How did you get into BSD?

2014-11-26

We've got a fun idea for the holidays this year: just like we ask during the interviews, we want to hear how all the viewers and listeners first got into BSD. Email us your story, either written or a video version, and we'll read and play some of them for...


Episode 251: Crypto HAMMER

2018-06-20

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines DragonflyBSD: Towards a HAMMER1 master/slave encrypted setup with LUKS I just wanted to share my experience with setting up DragonFly master/slave HAMMER1 PFS's on top of LUKS So after a long time using an Synology for my NFS needs, I...

Episode 250: BSDCan 2018 recap

2018-06-13

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines TrueOS to Focus on Core Operating System The TrueOS Project has some big plans in the works, and we want to take a minute and share them with you. Many have come to know TrueOS as the “graphical FreeBSD” that makes...

Episode 249: Router on a stick

2018-06-06

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines ZFS and DTrace update lands in NetBSD merge a new version of the CDDL dtrace and ZFS code. This changes the upstream vendor from OpenSolaris to FreeBSD, and this version is based on FreeBSD svn r315983. + r315983 is from...

Episode 248: Show me the Mooney

2018-05-30

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines DragonFlyBSD: release52 (w/stable HAMMER2, as default root) DragonflyBSD 5.2.1 was released on May 21, 2018 > Big Ticket items: > Meltdown and Spectre mitigation support Meltdown isolation and spectre mitigation support added. Meltdown mitigation is automatically enabled for all Intel cpus. Spectre mitigation must be enabled...