This is an old revision of the document!
Starting ''Xvnc'' on-demand
A nice refinement is to configure the remote host to start Xvnc
on-demand. By this I mean, when you connect to, say, your tunneled port localhost:5902
using vncviewer
, the remote host should have an inetd
listening on that port that starts your Xvnc
for you. The line in inetd.conf
might look like:
5902 stream tcp wait arfon /usr/bin/Xvnc Xvnc -Log *:syslog:30 passwordFile=/home/arfon/.vnc/passwd -inetd -query localhost -once
To use, you ssh
to the remote host, which creates the tunnel, then vncviewer
to the remote host, which creates the Xvnc
if needed, and attaches it. I've seen at least one VNC viewer (bVNC) that has builtin support for ssh
and combines these into one step, but haven't tried that.
Configured this way, Xvnc
queries a display manager, which draws a login prompt before it creates your session, just the way it would on a “real” console. After that the Xvnc
is persistent. You can detach from it and reattach from elsewhere and continue your work. (To prevent another authorized user from “walking up to your terminal”, you could set the vncpasswd
, or you could xlock
the display.) On my host I configured xdm
as the display manager. It starts at boot time and handles the session query. This should surely be generalizable to other display managers but I have not tried it. –metaed