Elegant solution for remotely accessible vnc desktops

I wanted to give windows users in my network quick access to a linux graphical desktop. I chose the vnc protocol, because there are many good and open source implementations (notably tightvnc which comes in a portable version).

  • vnc terminal server, which can handle any number of clients
  • very easy setup for users. Preparing a vnc client and telling users what server:port to connect is enough.
  • different resolutions chosen by the vnc port that the client connects to
  • From the local network: Almost none, clients connect to vnc ports 5951, 5952 etc. depending on the resolution they want.
    vncviewer -encodings tight ::5952
  • From remote, using ssh:
    • Create a port forward from 590x to 595x on the server
    • Connect your vnc client to localhost:595x
      Example:
      ssh yourserver.tld -L localhost:5902:localhost:5952
      vncviewer -encodings tight ::5902
  • Install xinetd and vnc4server
  • Change display manager to kdm
  • change kdmrc to allow xmdcp login
  • change Xaccess to allow login

Add custom services to your /etc/services file, so that your inetd.conf can use them:

# Local services                                                                           
custom-vnc 5951/tcp                                                                        
custom-vncc 5952/tcp                                                                       
custom-vnccc 5953/tcp                                                                      
custom-vncccc 5954/tcp   

Add one line per resolution you want to your inetd.conf. Add more resolutions at your taste. Of course, geometry should match the screen size of your clients.

#custom-vnc stream tcp nowait nobody /usr/bin/Xvnc Xvnc :8 -inetd -query localhost -once -geometry 1280x1024 -depth 24 -ac                                                            
custom-vnc stream tcp nowait nobody /usr/bin/Xvnc Xvnc :8 -inetd -query localhost -once -geometry 1024x768 -depth 24 -ac                                                              
custom-vncc stream tcp nowait nobody /usr/bin/Xvnc Xvnc :8 -inetd -query localhost -once -geometry 1280x1024 -depth 24 -ac                                                            
custom-vnccc stream tcp nowait nobody /usr/bin/Xvnc Xvnc :8 -inetd -query localhost -once -geometry 1680x1024 -depth 24 -ac

Ref: http://linuxreviews.org/howtos/xvnc/#toc3

~~LINKBACK~~

Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.