Hi,

I have found a reasonably good solution for running
Xvnc like WinVnc to remotely view the regular working
desktop for solaris.

I have posted it here in case somebody else is looking
for working examples like I was.

The basic idea as mentioned in the FAQ is to run
Xvnc as the primary server and run a VNC viewer to
display the contents of Xvnc on the regular X server.

Below is what I did for my solaris 2.6 desktop which 
runs dtlogin for the login screen:

Parameters -geometry 1280x1024, -depth 24 & -dpi 90
were obtained by running xdyinfo on regular display.

I am running Xvnc on display 0 and regular Xserver on
display 99. /users/msuresh is my home directory:

1. Create separate vnc password file
   /users/msuresh/.vnc/passwd.root by running
   vncpasswd or vncserver as root and giving
   /users/msuresh/.vnc/passwd.root as password file.
   This avoids problems when running vnc as regular
   user.

2. Make a directory /etc/dt/config if it does not
   exist and copy /usr/dt/config/Xservers to it. This 
   is because it is not recommended to edit
   /usr/dt/config/Xservers but to override it.
   Edit /etc/dt/config/Xservers. Change the last line
   to:

# \ means line continued
:0 Local local_uid@console root \
   /users/msuresh/bin/dtdisplay

3. dtdisplay is a perl script that starts Xvnc on
   display :0, local Xserver X on display :99 &
   vncviewer talking to Xvnc & displaying on :99.
   The script also catches SIGTERM & SIGHUP
   ( sent out by dtlogin while logging out )
   and kills Xvnc on receipt of SIGTERM. This is 
   required because Xvnc ignores SIGTERM. killing Xvnc

   kills vncviewer which kills X.

--- file: dtdisplay ---
#!/router/bin/perl

sub handler {       # 1st argument is signal name
    local($sig) = @_;

    $sendsig = $sig;
    if ( $sig =~ 'TERM' ) {
      $sendsig = 'INT' ;
    }
    kill $sendsig, $xvncpid;
    exit(0);
}

$SIG{'HUP'} = 'handler';
$SIG{'TERM'} = 'handler';

# Fork off a Xvnc server for use by dtlogin on
# Display 0. -auth parameter supplied by dtlogin.
if ( !($xvncpid=fork) ) {
  exec "/users/msuresh/bin/Xvnc :0 -desktop X \
-httpd /usr/local/vnc/classes -geometry 1280x1024 \
-depth 24 -rfbwait 120000 \
-rfbauth /users/msuresh/.vnc/passwd.root \
-rfbport 5900 -dpi 90 -fp tcp/localhost:7100 \
-alwaysshared @ARGV";
  exit(1);
}

# Start off regular X server on Display 99
# with a vncviewer as the primary program
# using xinit
sleep 1;
$ENV{PATH} .= ":/usr/openwin/bin";
system('/usr/openwin/bin/xinit \
/users/msuresh/bin/vncviewer msuresh-u10:0 \
-display :99 -passwd /users/msuresh/.vnc/passwd.root \
-truecolor -depth 24 -fullscreen -- \
 /usr/openwin/bin/X :99');
--- end of dtdisplay ---

4. Done

dtconfig -kill stops dtlogin and
/etc/init.d/dtlogin start starts it. Executing
these two through telnet should bring up the new
login screen. While debugging you can make sure
that Xvnc and X are not running after killing
dtlogin by doing grep for "-i vnc" and openwin on
ps -aef output.

For debugging one can see dt error file
/var/dt/Xerrors ( This is a dt config parameter )
or redirect xinit outputs or check perl syntax by
perl -compile dtdisplay.

When done you get a remote viewable display like 
WinVnc. Logging out or rebooting disconnects remote 
viewer and one can reconnect when new login screen 
comes.

You can also choose between CDE & OPENWINDOWS.

The local display looks more or less similiar to the
original. Logging in and logging out is slightly
slower. Auto screen lock & blank do not work. I think
this is because Sun's X somehow passes inactivity info
which Xvnc does not.

Pseudo color is not available. X sun can give pseudo
colors along with truecolor but Xvnc cannot. Using
just pseudo colors makes the regular desktop display
poor.

To restore your desktop to the original state just
move /etc/dt/config/Xservers* files to some other 
place.

My below attempts of creating a shareable display
after logging onto console also gave better results
on dropping pseudo color and passing -depth 24 option
to both vncserver and vncclient.

Suresh.

--- Suresh Mahalingam <[EMAIL PROTECTED]> wrote:
Hi,

  I have recently started using VNC and have been
  trying to make VNC on solaris/CDE similiar to
  WinVNC so that I can remotely work on the existing
  screen display rather than having a separate one
  for VNC.

  I have had reasonable success with the following
  approach I got from the vnc-list archives of running
  the working XSession through a shared vncserver:

1. Change the last line of xstartup in ~/.vnc:

#twm &
Xsession
vncserver -kill :1

2. Delete all startup commands from ~/.xinitrc and
replace with

vncviewer <machine-name/localhost>:1 -passwd
~/.vnc/passwd -fullscreen
2>/dev/null

I had to add 2>/dev/null because otherwise the
vncserver startup
message was showing on the console.

3. Create a script startvnc containing the command:

vncserver -geometry 1280x1024 -depth 8 -cc 3 -dpi 90
-fp \
 tcp/localhost:7100 -alwaysshared -nolisten local

I got 1280x1024 by running xdypinfo.

I know this command can be added to the .xinitrc
followed
by sleep 10.

4. Turn off dtlogin autostart by running dtconfig -d
   as root and rebooting the machine.

5. Login onto console, run startvnc followed by xinit

The above gives good results except for the following
defects:

1. There is some drop in the color quality though it
improved
   after adding -cc option. increasing depth to 16/24
makes things
   worse.

2. When I start programs like netscape I get the
warning:

Warning: Cannot allocate colormap entry for "gray77"

for different colors like SeaGreen, Brown, SlateBlue
etc.

3. I get console messages on the screen which do not
clear
   with doing a Refresh. I do not see them with a
normal
   CDE display.

4. Auto blank screen does not work properly. I was
getting
   a dark and shaking shadow of the oringinal screen
which
   came to the regular screen on moving the mouse.

5. Auto lock screen after inactivity does not work.

Is this the best I can get?

I know there is a way to make dtlogin come up using
vncviewer.
Will that fix some of the above problems? I would
rather not
make too many config changes as root. Here the only
change I
made was running dtconfig -d which can be restored by
dtconfig -e.

I know that x0rfbserver works on the running XServer
rather
than create its own XServer. But I do not think there
is a version for
Solaris.

Thanks,
Suresh.

__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
---------------------------------------------------------------------
To unsubscribe, mail [EMAIL PROTECTED] with the line:
'unsubscribe vnc-list' in the message BODY
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------

Reply via email to