Showing posts with label #VNC. Show all posts
Showing posts with label #VNC. Show all posts

2014-06-13

vncconfig for Xvnc4

Starting with the current Xvnc4, there is a helper app available:  vncconfig

pdw@zipper:~$ man -P cat vncconfig 
vncconfig(1)               Virtual Network Computing              vncconfig(1)



NAME
       vncconfig - configure and control a VNC server

SYNOPSIS
       vncconfig [parameters]
       vncconfig [parameters] -connect host[:port]
       vncconfig [parameters] -disconnect
       vncconfig [parameters] [-set] Xvnc-param=value ...
       vncconfig [parameters] -list
       vncconfig [parameters] -get Xvnc-param
       vncconfig [parameters] -desc Xvnc-param

DESCRIPTION
       vncconfig  is used to configure and control a running instance of Xvnc,
       or any other X server with the VNC extension.  Note that it  cannot  be
       used to control VNC servers prior to version 4.

       When run with no options, it runs as a kind of "helper" application for
       Xvnc.  Its main purpose when run in this mode is to  support  clipboard
       transfer  to  and  from the VNC viewer(s).  Note that without a running
       instance of vncconfig there will be no clipboard support.  It puts up a
       window  with  some  checkboxes  which  can be used to disable clipboard
       transfers if required (in the future there may be more functions avail‐
       able from this window).  The -nowin flag can be used if you always want
       clipboard support but don't wish to clutter the desktop with this  win‐
       dow - alternatively the -iconic option can be used to make it iconified
       by default.

       When run in any other mode, vncconfig is a  one-shot  program  used  to
       configure  or control Xvnc as appropriate.  It can be used to tell Xvnc
       to connect or  disconnect  from  listening  viewers,  and  to  set  and
       retrieve Xvnc's parameters.

       Note  that the DISPLAY environment variable or the -display option must
       be set as appropriate to control Xvnc.  If you run it on an ordinary  X
       server  (or  on  a version 3 Xvnc) you will get an error message saying
       that there is no VNC extension.


OPTIONS
       -connect host[:port]
              Tells an Xvnc server to make a "reverse" connection to a listen‐
              ing  VNC  viewer  (normally  connections  are made the other way
              round - the viewer connects to the server).  host  is  the  host
              where  the listening viewer is running. If it's not listening on
              the default port of 5500, you can specify host:port instead.


       -disconnect
              This causes Xvnc to disconnect from all viewers so that the  VNC
              desktop is not displayed anywhere.


       [-set] Xvnc-param=value
              Sets  an  Xvnc  parameter to the given value.  Note that some of
              Xvnc's parameters are read only once at startup so that changing
              them in this way may not have any effect.


       -list  Lists all the parameters supported by Xvnc.


       -get Xvnc-param
              Prints the current value of the given Xvnc parameter.


       -desc Xvnc-param
              Prints a short description of the given Xvnc parameter.


PARAMETERS
       vncconfig  also  has parameters of its own which can be set on the com‐
       mand line.  These should not be confused with Xvnc's  parameters  which
       are manipulated with the -set, -get, -list and -desc options.

       Parameters  can be turned on with -param or off with -param=0.  Parame‐
       ters which take a value can be specified as -param value.  Other  valid
       forms  are param=value -param=value --param=value.  Parameter names are
       case-insensitive.


       -display Xdisplay
              Specifies the Xvnc server to control.


       -nowin When run as a "helper" app, don't put up a window.


       -iconic
              When run as  a  "helper"  app,  make  the  window  iconified  at
              startup.


SEE ALSO
       vncpasswd(1), vncviewer(1), vncserver(1), Xvnc(1)
       http://www.realvnc.com


AUTHOR
       Tristan Richardson, RealVNC Ltd.

       VNC  was  originally  developed  by  the RealVNC team while at Olivetti
       Research Ltd / AT&T Laboratories Cambridge.  It is now being maintained
       by RealVNC Ltd.  See http://www.realvnc.com for details.



RealVNC Ltd                       03 Mar 2005                     vncconfig(1)
pdw@zipper:~$ date -u
Fri Jun 13 03:50:16 UTC 2014

2014-06-12

VNC for ChromeOS

https://bitbucket.org/saljam/vnc &nash; Overview
This is a VNC viewer Chrome app. It uses Chrome's sockets API to talk to the VNC server directly.
The RFB rendering is based on NoVNC[0]. The icon is based on "Computer" from the Noun Project[1].
[0] http://kanaka.github.com/noVNC/
[1] http://thenounproject.com/noun/computer/#icon-No115
Note the use of markdown style links in the page content shown above.
HACK.md



Make sure:
  1. vncserver is installed on the Debian machine
  2. user account on the remote host is configured to allow ssh public key login
  3. vnc client app is installed on local host
  4. ssh private key (key pair) is installed on local host
  • Using VNC Viewer for Chrome OS to connect to a Debian server running Xvnc4 server.


Xvnc4server Startup Error: hidden lock files in /tmp

Xvnc4server creates two (2) lock-files in the /tmp directory when it starts up.

If the VNC server shuts down normally (e.g. with vncserver -kill :$NN (where $NN is the VNC display port number), these files are removed.

Xvnc4servev checks for the existence of these files on start-up, and exits with an error message if either exists.

Debian Linux Xvnc4server creates lockfiles in /tmp/. The lock-files are:

  • /tmp/X{nn}-lock
  • /tmp/.X11-unix/X{nn}

where {nn} is the port number of the display. Note that these files are hidden, and that the naming can be confusing if the VNC server in question was started on display port :11 (since 11 is also the version part of X11, and the : is dropped from the display spec when the file name is constructed by xvncserver at startup.

Also: while VNC is running there may be other user-owned lock-files in /tmp that appear during VNC server operation. The ones listed here are the ones controlled by the VNC server itself.

If Xvnc4server has died and left these lock-files in place, VNC connection attempts (via SSH tunnel) will report network connection failed errors on the client-side, and open failed: connect failed: Connection refused channel errors on server-side console during connection attempts.

This condition can be confirmed using the following command from the shell prompt on the server:

    ps ax | grep `cat /tmp/.X$NN-lock`

Where $NN is the number of the display you're looking for.

If the command returns a process table entry for a running VNC server at with the PID stored in the lockfile, then there is some other problem - if the command returns nothing, or only the proc table entry for e.g. the grep process itself, then the lockfiles may be safely removed, and the VNC server for the port restarted.

2009-05-13

Detecting active VNC server instances

I needed something to tell me what VNC server (vncserver()) instances were running, and on which DISPLAY ports, and with what resolution(s) (geometry), so I wrote one. Here is the HTMLized Perl source code:

#!/usr/bin/perl -w
######################################################################
## FILE:  findvncport.pl 

## DESC:  display information about VNC server instances
## VERS:  01
## DATE:  2009-05-13
## AUTH:  pdw@thesoftwaremaster.com
##############################################################################
##  USAGE NOTES:
##
##    This is a script to find out the connection port number and screen
##    geometry of any VNC server instances currently running on a host.  

##
##    This functionality is most useful to a user who needs to know what VNC
##    server instance(s) is(are) running, and on what port(s) - E.G.  at logon
##    (to a shell) time when a vncserver has been left running.
##
##    For convenience, the geometry of the X interface, the PID of Xvnc (the
##    actual X server invoked by vncserver), and such other info as we can
##    glean from the process listing on the host.
##

##    Note that this script only returns information about VNC instances
##    running under the UID of the user who runs the script.  The value of
##    the environment variable $USER is used to filter the process listing.
##    The user's $UID value is displayed, but is not used.
##
##    This program is designed to be run on a remote, ssh-accessible host
##    computer during the login and user account initialization process.
##
##  EXAMPLE:

##
##    I place this script in the .bash_login shell script that runs at user
##    login.
##
##
##  _TODO_: there is no buglist, yet, but there are some things need done to
##          this script right to begin with (i.e. the functionality is
##          marginal, and will almost certainly "break" the first time someone
##          tries to use it on some other platform or environment.  First on

##          the list of things to do must be: Fix the regular expression
##          parsing which finds the data in the process listing.  As the code
##          is now, these regex statements will break e.g. if the Xvnc command
##          line doesn't look like it expects. 2nd on the list has to be the
##          addtion of command line parameters to modify the output of the
##          script. :_TODO_
##
#############################################################################
##  REVISION HISTORY:

##
##     01: 2009-05-13 pdw
##         Initial version
##
#############################################################################
##
## Load up some environmental info...
$curruid = `echo \$UID`;

$curruser = `echo \$USER`;
@processes = `ps x -u \$USER`;
chomp($curruid);

chomp($curruser);

## @displays gets the data about whatever VNC displays are running
@displays = ();

while ($_ = shift(@processes)) {

 my $d = {};
 my $found = 0;
 chomp;

 next unless ($_);
  
 next unless (/^\s*(\d+).+Xvnc\s*(\:\d+)/)

  && ( $display = $2, $vncpid = $1 );

 # get desktop 

 m/-desktop(.+)-httpd/ 
  && ($desktop = $1);

 m/-geometry\s+(\d+x\d+)/
  && ( $geometry = $1 );

 m/-depth\s+(\d+)/
  && ( $depth = $1 );

 $d = {
  'Display'  => $display,
  'VNC PID'  => $vncpid,

  'Desktop'  => $desktop,
  'Geometry' => $geometry,

  'Depth'    => $depth,
 };
 push(@displays, $d);

}

## Display what we found out 
print "VNC server info for USER \'$curruser\':\n";
if (scalar(@displays)) {

 foreach my $disp (@displays) {
  foreach my $k (keys(%$disp))

  {
   print"  $k: \t".$disp->{$k}."\n";

  }
 }
} else {
 print "
  VNC server not found in process listing.

";
}