[BL] vnc client in basic linux

Sindi Keesan keesan at iamjlamb.com
Thu Jan 22 22:56:42 EST 2004


On Fri, 23 Jan 2004 3aoo-cvfd at dea.spamcon.org wrote:

> M. Yousuf Bin Azhar wrote:
> >
> > can anyone guide me how to setup a vnc viewer / client 
> > on basiclinux?
> 
> What's vnc?  I've seen it mentioned in a few places, 
> but I haven't a clue what it is supposed to do.  
> A method of connecting to Windows machines?
> 
> Cheers,
> Steven
> _______________________________________________


I did a web search and found lots of information on vnc and linux:

   Articles, tips and tricks at http://www.SourceCodeCorner.com

[This was at www.sourcecodecorner.com/articles/vnc/linux.asp]


   Setting up VNC on Linux
   By Jeff Vincent

   One of the biggest unanswered questions on the VNC mailing list is
   connecting to Linux systems and getting a logon screen. Sure, you can
   run vncserver from the X environment, then log in remotely, but how
   about having seperate X sessions and multiple users, with the vnc
   server coming up when the machine boots up, so there is no interaction
   at the console.

   Hopefully, the details below will help the situation. Some are version
   specific and distibution specific. The details here apply to Redhat
   Linux. If you have working details for other distributions and version
   that are different to here, please either leave a message in our
   forum or email webmaster at sourcecodecorner.com

   This set up doesn't set any specific security. The security of you
   Linux system is your responsibility.


   The files mentioned in these instruction are below.

   1) Install VNC
             a) if installed to directory other than /usr/local/bin, edit
   the vnc paths in the 'vncserver.*' files (the ones used in the page
   below).

   2) edit 'xdm-config' and comment out the line '!
   DisplayManager.requestPort: 0' (should be the last line)
             a) RedHat 6.2, 7.1, 7.2 - '/etc/X11/xdm/xdm-config'

   3) edit 'kdmrc' and enable XDMCP on port 177 (if kde is new enough)
             a) RedHat 7.2 - '/etc/kde/kdm/kdmrc'
             b) If running Gnome as your desktop, start gdmconfig, select
   Expert Mode, ensure that Enable XDMCP is checked. (You must be logged
   in as root)

   4) edit Xaccess and uncomment the line '*        #any host can get a
   login window'
             a) RedHat 6.2, 7.1, 7.2 -' /etc/X11/xdm/Xaccess'

   5) append contents of 'services.inetd' to 'services'
             a) Linux - '/etc/services'

   6) Update inetd configuration for the services to enable (based on
   /etc/services)
             a) inetd - append contents of 'vncserver.inetd' to
   '/etc/inetd.conf'
             b) xinetd - copy 'vncserver.xinetd' to '/etc/xinetd.d' (RH
   7.2 (not available in my RH6.2)

   7) reboot (or restart inetd/xinetd and xdm or equivalent)
             a) xdm i) Running KDM, to restart, killall kdm
                         ii) Running GDM, to restart, killall gdm
             b) xinet i) RedHat 7.1/7.2 - '/etc/init.d/xinet restart'


   The file below is the services.inetd. This needs to be added to the
   end of /etc/services. Please note, there should be a tab between the
   vnc-xxxxxxxxx and the xxxx/tcp. The numbers (i.e. 5950, 5951 etc) are
   the port numbers to connect to, removing the 59 part, so the first one
   will be 50.

   # # VNC Servers
   #
   vnc-640x480x8 5950/tcp
   vnc-800x600x8 5951/tcp
   vnc-1024x768x8 5952/tcp
   vnc-1280x1024x8 5953/tcp
   vnc-1600x1200x8 5954/tcp

   vnc-640x480x16 5960/tcp
   vnc-800x600x16 5961/tcp
   vnc-1024x768x16 5962/tcp
   vnc-1280x1024x16 5963/tcp
   vnc-1600x1200x16 5964/tcp

   vnc-640x480x24 5970/tcp
   vnc-800x600x24 5971/tcp
   vnc-1024x768x24 5972/tcp
   vnc-1280x1024x24 5973/tcp
   vnc-1600x1200x24 5974/tcp

   vnc-640x480x32 5980/tcp
   vnc-800x600x32 5981/tcp
   vnc-1024x768x32 5982/tcp
   vnc-1280x1024x32 5983/tcp
   vnc-1600x1200x32 5984/tcp


   The file below is vncserver.inetd. This should be added to the end of
   /etc/inetd.conf. Please note the path. In this document the path is
   /usr/local/bin/Xvnc. This will need to be modified based on your own
   system.

   # # VNC XServer
   # Each line should be on one line, starting vnc- and ending -depth x
   where x is the number.
   #
    vnc-640x480x8 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 640x480 -depth 8
   vnc-800x600x8 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc -inetd
   -query localhost -once -geometry 800x600 -depth 8
   vnc-1024x768x8 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1024x768 -depth 8
   vnc-1280x1024x8 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1280x1024 -depth 8
   vnc-1600x1200x8 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1600x1200 -depth 8
   #
   vnc-640x480x16 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 640x480 -depth 16
   vnc-800x600x16 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 800x600 -depth 16
   vnc-1024x768x16 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1024x768 -depth 16
   vnc-1280x1024x16 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1280x1024 -depth 16
   vnc-1600x1200x16 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1600x1200 -depth 16
   #
   vnc-640x480x24 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 640x480 -depth 24
   vnc-800x600x24 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 800x600 -depth 24
   vnc-1024x768x24 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1024x768 -depth 24
   vnc-1280x1024x24 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1280x1024 -depth 24
   vnc-1600x1200x24 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1600x1200 -depth 24
   #
   vnc-640x480x32 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 640x480 -depth 32
   vnc-800x600x32 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 800x600 -depth 32
   vnc-1024x768x32 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1024x768 -depth 32
   vnc-1280x1024x32 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1280x1024 -depth 32
   vnc-1600x1200x32 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1600x1200 -depth 32
   # # End.


   You can also define none standard screen sizes. It is not limited to
   your graphics card. This needs to be done in both the above files.

   In /etc/inetd.conf, you would add your required screen size and bit
   depth, so say you have a 1024x768 screen, and don't want VNC to
   present scroll bars, you could define it as 1000x700. I would like a
   colour depth of 16 bits. I will use an unused port for this. It will
   be 5990.

   This would be

   vnc-1000x700x16 stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc
   -inetd -query localhost -once -geometry 1000x700 -depth 16

   Note the geometry at the end. This is your screen definition. The
   vnc-1000x700x16 is a pointer to what needs to be in your
   /etc/services. Don't forget to edit your path to suit your system.

   Look at your /etc/services. We now need to match the definition to the
   port, 5990.

   vnc-1000x700x16 5990/tcp


   Our last file is for Redhat 7.2 This should be copied to the end of
   /etc/xinet.d. Again, modify the paths to suit your system. This is the
   vncserver.xinetd.

   service vnc-640x480x8
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   640x480 -depth 8
   }

   service vnc-800x600x8
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   800x600 -depth 8
   }

   service vnc-1024x768x8
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1024x768 -depth 8
   }

   service vnc-1280x1024x8
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1280x1024 -depth 8
   }

   service vnc-1600x1200x8
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1600x1200 -depth 8
   }

   service vnc-640x480x16
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   640x480 -depth 16
   }

   service vnc-800x600x16
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   800x600 -depth 16
   }

   service vnc-1024x768x16
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1024x768 -depth 16
   }

   service vnc-1280x1024x16
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1280x1024 -depth 16
   }

   service vnc-1600x1200x16
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1600x1200 -depth 16
   }

   service vnc-640x480x24
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   640x480 -depth 24
   }

   service vnc-800x600x24
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   800x600 -depth 24
   }

   service vnc-1024x768x24
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1024x768 -depth 24
   }

   service vnc-1280x1024x24
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1280x1024 -depth 24
             # port = 5973
   }

   service vnc-1600x1200x24
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1600x1200 -depth 24
   }

   service vnc-640x480x32
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   640x480 -depth 32
   }

   service vnc-800x600x32
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   800x600 -depth 32
   }

   service vnc-1024x768x32
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1024x768 -depth 32
   }

   service vnc-1280x1024x32
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1280x1024 -depth 32
   }

   service vnc-1600x1200x32
   {
             protocol = tcp
             socket_type = stream
             wait = no
             user = nobody
             server = /usr/local/bin/Xvnc
             server_args = -inetd -query localhost -once -geometry
   1600x1200 -depth 32
   }


   Debugging your connection to VNC.

   1. If you find you cannot connect, this could be a few things. Ensure
   that the path in your inetd.conf and xinetd.d point to the same place
   as your actual vnc executables.

   2. See if your Xvnc is running. From a remote machine, telnet to the
   machine hosting VNC, using the full port number you have defined in
   your services file. In this case, an example would be port 5951. (This
   would test the VNC for 800x600x8). If no response, you may not be on
   the same subnet, or you have a firewall in the way. The normal
   response would be rubbish, but it proves that you have an open port to
   connect to.

   3. Test if your XDMCP is running. This uses port 177, but uses UDP, so
   telnet will not work against it. You can use something like nmap
   http://www.insecure.org/nmap/ to test this port. The command line
   would be:

   nmap -sU -p 177 hostname (change the hostname to suit your system).

   You can also use nmap to test your regular vnc ports. If not running,
   check part 3 of the configuration instructions.


   This article was originally submitted by Jeff Vincent. The article has
   been updated with contributions by other members of the VNC mailing
   list, hosted by AT&T.




More information about the BasLinux mailing list