twm on Ubuntu for vncserver

This works “out of the box” on RHEL. Not so much on Ubuntu.

When you’ve got 200+ servers outfitted with RealVNC free edition for Linux and need to do some serious xterm work, it’s not helpful when the Ubuntu default is Gnome’s remote desktop server, vino. Sure, there are times you do want access the actual desktop of a particular user, but there is real utility (and usually greater efficiency) in a persistent (sort of), plain vanilla X session on a server for just getting stuff done.

Fixing this just took a little customization on the Ubuntu side. First, uninstall vino. Then install:

vnc4server
xvnc4viewer

The latter is the real RealVNC viewer app that you’ve come to know and love. Also make sure that

vnc4-common
libgtk-vnc

are also installed.

You should also edit /etc/X11/twm/system.twmrc and insert a handy menu item for xterm into main:

menu "main"
{
     "Main Menu"             f.title
     "XTerm"                 f.exec  "xterm &"

While you’re busy hacking system.twmrc. you may also want to add the RandomPlacement directive as detailed in this earlier post.

Create a VNC server session as under RHEL by first making sure you set a password with vncpasswd, and then executing vncserver. Kill any unwanted sessions by doing a vncserver -kill :[display number] (e.g. “-kill :1”). As a best practice I try not to leave running vncserver sessions around longer than necessary, another reason I’m not thrilled with the “automatic startup on boot” behavior of vino (or RealVNC on Windows, for that matter).