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

Hi, Mr. Dexter...

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 210: Your questions, part I

2017-09-06

Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines A Reimplementation Of Netbsd Using a Microkernel Minix author Andy Tanenbaum writes in Part 1 of a-reimplementation-of-netbsd-using-a-microkernel Based on the MINIX 3 microkernel, we have constructed a system that to the user looks a great deal like NetBSD. It uses pkgsrc,...

Episode 209: Signals: gotta catch ‘em all

2017-08-30

Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines Trip Report: FreeBSD in China at COPU and LinuxCon This trip report is from Deb Goodkin, the Executive Director of the FreeBSD Foundation. She travelled to China in May 2017 to promote FreeBSD, meet with companies, and participate in discussions around Open...

Episode 208: Faces of Open Source

2017-08-23

Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines LLVM, Clang and compiler-rt support enhancements In the last month I started with upstream of the code for sanitizers: the common layer and ubsan. I worked also on the elimination of unexpected failures in LLVM and Clang. I've managed to...

Episode 207: Bridge over the river Cam

2017-08-16

Direct Download:HD VideoMP3 AudioTorrent This episode was brought to you by Headlines BSDCam recap The 2017 Cambridge DevSummit took place from 2-4 August 2017. The event took place over three days including a formal dinner at St John's College, and was attended by 55 registered developers and guests. Prior to the start of...