Xvnc xinetd-based dynamic remote sessions

To allow for remote, Xvnc-based sessions from the network to a Linux machine using vncserver, we can leverage the xinetd infrastructure to dynamically, and on-demand, spawning Xvnc servers for incoming remote connections. To do so, create a file named /etc/xinetd.d/xvncserver:

  # cat > /etc/xinetd.d/xvncserver
  service vnc
  {
    protocol    = tcp
    socket_type = stream
    wait        = no
    user        = nobody
    server      = /usr/bin/Xvnc
    server_args = -inetd -query localhost -once \
                  -geometry 800x600 -depth 16 \
                  -desktop fab.felipe-alfaro.com \
                  -securitytypes=none
  }

Then, add the following line to file /etc/services:

  vnc             5901/tcp

Port 5901/tcp corresponds to the first display of an VNC server, that is, display :1. Thus, when using the vncviewer client, the :1 parameter must be passed to specify this display.

The last step is to restart the xinetd daemon by running:

  # service xinetd restart

NOTE: For this to work, XDCMP support must be enabled for XDM/GDM/KDM or whatever login manager is being used. This is due to Xvnc using -query localhost in order to present a login screen.

Leave a Reply