Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Google   


VNC on Solaris

News See also Recommended Links Recommended Articles X11vnc Radmin
Starting VNC server RC scripts The vncserver modification .Xdefaults Xstartup  
Typical  mistakes VNC on Windows VNC on Linux   Humor Etc

VNC was originally written for Solaris and Solaris 8, 9 and 10 supports VNC extremely well.  For Solaris 10 Xvnc is also an interesting option, but old good VNC works OK.

VNC is heterogeneous client-server application that uses it own protocol. In a way it is similar to Windows Remote Desktop but it can be run for each user and users can have different desktops.  It works less efficiently on slow lines but it does work. Radmin might be a better choice for slow line or if you need a session encryption.  For more details see  main VNC page. The most typical usage of VNC is when the client (VNC viewer) is running on Windows and server on Unix, in our case this is a Solaris server.

You have several options as for viewer on Windows and VNC server on Solaris.

As for viewer TightVNC is recommended as a client on Windows. It's perfectly compatible with all existing VNC servers (you do not need to run TightVNC on the server if you are using TightVNC viewer on Windows. It is also compatible with  x11vnc and provides better color correspondence and graphic correspondence that a regular VNC client (especially noticeable if you use CDE as windows manager for VNC server).  See main VNC page  for details and short tutorial on configuration.

NOTES:

Server

If we are are talking about the source the sky is the limit. You can compile TightVNC or whatever server you might want. If we are talking about precompiled packages that there are three major solutions for VNC server in Solaris:

The vncserver script modification

The script vncserver is simultaneously an installation script and optionally can serve as a startup script.  As an installation scrip it created and populated ~/.vnc directory with several files. The most important of those is xstartup. This directory also stores password for the session.  To start VNC you need to launch XVNC with proper environment and parapeters. 

You can use CDE (launch dtwm manager), GNOME (gnome-session or startgnome) or KDE (startkde) as a windows manager in VNC.  Each of them should have proper, verified path -- wrong path is the most common installation mistake people make.

One way to specify windows manager is to edit vncserver Perl script.  The variable that specifies the default manager is  $defaultXStartup. It contains several parameters and  the windows manager is specified at the very end of the value of this variable (usually on the last separate line). In this case when vncserver will run the first time it will create .vnc directory and populate it with files that contain the necessary parameters (the name of the windows manager gores to  xstartup).

In you have several windows managers installed then you can modify vncserver Perl script and set one on them to be the default windows manager. Common options include: 

  1. CDE (launch /usr/dt/bin/dtwm manager). You need to verify that all the necessary libraries are available in the PATH, so that your environment permit finding of the necessary libraries. Otherwise VNC will run the default windows manager.  This is the most common choice and works well in the Solaris environment.
     
  2. If you have a development machine with GNOME installed then you can use gnome-session or startgnome. Please remember that GNOME 2.x is a classic example of bloatware and as such might be not a good choice for production server, although it is nice on desktop or workstation. The main advantage for development is that installation of Gnome provides most libraries necessary for other applications and thus simplifies the usage of many interesting open source applications making Solaris much more "linux compatible".  
     
  3. KDE (startkde). KDE is pretty rare on Solaris.

Here is an example, where vncserver Perl script was edited to set the default windows manager to CDE ("safe choice"):

$defaultXStartup
= ("#!/bin/sh\n\n".
"[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n".
"xsetroot -solid grey\n".
"xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".

"/usr/dt/bin/dtwm &\n");

Typical installation mistakes:

If you still want bloated Gnome 2.0 as your desktop here is an example (gnome-session should in your path or you need to specify the directory; you can use gnome-session instead of  startgnome; ensure the correct path and that all the necessary libraries are present in the path):

 $defaultXStartup = ("#!/bin/sh\n\n". "xrdb \$HOME/.Xresources\n". "xsetroot -solid grey\n". "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n". "/opt/gnome-1.4/bin/gnome-session &\n");

See VNC on Solaris 10 for details necessary for gnome in case it is also your default desktop (do not use the ksh installation script provided -- it makes several assumptions and perform actions without proper verification if  the conditions for those actions are present on your system).

After that you can run vncserver script and it will ask you for session password. During this invocation it will create the directory .vnc in your home directory and will put into it several files.  One of them is xstartup that contains the content of the Perl variable that we discussed above:

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
/usr/dt/bin/dtwm &

You can edit this file to change windows manager to the manager that you personally prefer  if you change your mind later on (it's shown in red).

You can also change several parameters in  .vnc/xstartup to make VNC more customised to you tastes:

#!/bin/sh

xrdb $HOME/.Xresources

xsetroot -solid grey

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#/usr/openwin/bin/twm &

/opt/gnome-1.4/bin/gnome-session &

Here are some recommendations for .Xdefaults

XTerm*geometry: 80x32

XTerm*scrollBar: on

XTerm*saveLines: 750

XTerm*Background: blue

XTerm*Foreground: white

*Font: -adobe-courier-bold-r-*-*-14-*-*-*-*-*-*-*

 

 


Notes:
  • Those pages are written by people for whom English is not a native language. Some amount of grammar and spelling errors should be expected.
  • This is a Spartan WHYFF (We Help You For Free) site. It cannot replace the best teachers and the best books.
  • The site contain some obsolete pages as it develops like a living tree... Some links on older pages are broken. Please try to use Google, Open directory, etc. to find a replacement link (see HOWTO search the WEB for details). We would appreciate if you can mail us a correct link.

Search Amazon by keywords:

Google   
Open directory

Research Index

 

Old News ;-)

Things i've learned about Solaris...

as to VNC, you need to reset the permissions on xstartup in the .vnc folder before it can execute its script and start your desktop. Otherwise you'll only get a blank checkerboard screen and the oh-so-familiar X cursor. You can reset them like so:

chmod 0744 $home/.vnc/xstartup

If you want to start KDE, you can place startkde in your xstartup file. I've found that the JDS 3.0 works just fine with VNC, instead of startkde, use gnome-session. My xstartup looks like so:

#!/bin/sh

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session

Now to figure out how to start this bugger automagically at boot....

VNC for Solaris10

This was remarkably easy to get going on my X2100, with the first and U2 releases of Solaris 10.

With 11/06 (U3), it does not work for me; I see only the grey X desktop and no login window. For 11/06 I recommend using (howto).

  1. Download RealVNC server package (Download & Use -> confirm form -> Find the latest Solaris package) (update: As of March 2007 there is no Solaris/x86 package available for download - it has been removed. I don't know why; it worked just fine for me. Try the Solaris Companion DVD's SFWvnc package instead - pkgadd -d /mnt/tmp/Solaris_Software_Companion/Solaris_i386/P ackages SFWvnc)
  2. Install package
    pkgadd -d vnc-4_1_1-x86_solaris.pkg
  3. Add the 'vnc' service to /etc/services:
    echo 'vnc 5900/tcp' >>/etc/services
  4. Convert and import the inetd configuration line to Solaris 10's new Service Management Framework:
    echo 'vnc stream tcp nowait nobody /usr/local/bin/Xvnc Xvnc -inetd -query localhost -once securitytypes=none' >> vnc.inetd.conf
    inetconv -i vnc.inetd.conf
    (note, if using the Companion CD package, command is /opt/sfw/bin/Xvnc)

    To later change the resolution of the spawned server, or any other options, change the exec property as follows:

    inetadm -m network/vnc/tcp exec="/usr/local/bin/Xvnc -inetd -query localhost -once securitytypes=none -screen 0 1280x1024x16"
    Then you can use inetadm to manage it:
    inetadm -l svc:/network/vnc/tcp:default (show details - giving full service name)
    inetadm -d network/vnc/tcp (disable - you can abbreviate the service name like this)
    inetadm -e network/vnc/tcp (enable)
    May be necessary to restart inetd:
    svcadm restart inetd
  5. Connect to VNC port 5900 to see the desktop login!

[Jul 26, 2007] VNC for Solaris10

Hi, I use RealVNC 4 and it works perfectly, these are steps I follow to make it work- I use running SSH and it works really well, I run Putty and create the connection, then I run vnc viewer. I use this on a Sparc5, Ultra 5 and Blade 100. I hope it works for you:

VNC Solaris 10 RealVNC ver. 4.0 running under SSH.

a)
File to use: “vnc-4.0-sparc_solaris_2.5.tar.gz”
(I use this version because I have absolutly no problems with it)
#gunzip vnc-4.0-sparc_solaris_2.5.tar.gz
#tar –xvf vnc-4.0-sparc_solaris_2.5.tar
#cd vnc-4.0-sparc_solaris_2.5


b) To install (copy) the files to the path run the following:
#./vncinstall /usr/bin

c) Add this line to .profile (under the user):
PATH=/usr/dt/bin:/usr/openwin/bin:$PATH
vncserver -depth 24 -geometry 800x600


d) NOTE: (Most likely this file will be created when logged the first time using SSH under the user, so it may no be needed under root):

Create a /.vnc directory with the xstartup file inside:

echo "#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
gnome-session
#startkde
#/usr/dt/bin/dtsession
" > xstartup
chmod 744 xstartup To make it executable


note:
CDE gnome-session < To login running CDE, gnome or kde sessions:>
Gnome /usr/dt/bin/dtsession< comment with '#' the one you don't >
KDE startkde < want to use, here it will start kde.>




*** Sample used on .profile file (under user)

$ cat .profile
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
# ident "@(#)local.profile 1.10 01/06/23 SMI"
stty istrip
PATH=/usr/bin:/usr/ucb:/etc.
export PATH
PATH=/usr/dt/bin:/usr/openwin/bin:$PATH
vncserver -depth 24 -geometry 800x600
$


NOTE: This can be added under /etc/profile to be run for

[Jul 26, 2007] VNC for Solaris10

lmccodj
Posts:5
Registered: 8/25/06

Re: VNC for Solaris10   
Feb 9, 2006 7:39 AM (reply 1 of 9)

Hi,
I am not using the one from sunfreeware.com I have the one that is delivered with the Solaris 10 Companion CD. The package name is SFWvnc.
The binary /opt/sfw/bin/Xvnc requires the two libraries
- /usr/sfw/lib/libgcc_s.so.1
- /usr/sfw/lib/libstdc++.so.6
available in the package SUNWgccruntime
set LD_LIBRARY_PATH to /usr/lib:/usr/sfw/lib:/lib in the startup script and you should be in business.

In your case you might be missing a library, check with ldd on x11vnc binary

[Apr 2, 2007] Solaris 10, gcc and VNC server by jalzabrewer

May 28, 2005 (forum.java.sun.com) VNC is on the SUN Supplimental SFW disk for Soalris 10 system SFWvnc vnc - Virtual Network Computing. Here is my implementaion using dtlogin xdm login feature of broadcast, if any one comes up with a way to use sse, let me know!

1. pkgadd -d . SFWvnc

2. Add to /etc/services

nc1024 stream tcp nowait root /usr/local/bin/Xvnc-1024 Xvnc-1024

3. Add to /etc/inetd.conf

vnc1024 stream tcp nowait root /usr/local/bin/Xvnc-1024 Xvnc-1024

4. Create /usr/local/bin/Xvnc-1024 script , perm 755.

#!/bin/sh
/opt/sfw/bin/Xvnc -inetd -broadcast -once -geometry 1024x768 -depth 8



5. Stop dtlogin

/etc/init.d/dtlogin stop

6. [Restart indentd] kill -HUP inetd-pid

7. Start dtlogin

/etc/init.d/dtlogin start

8. /usr/sbin/shutdown -y -g0 -i6 to test startup.

9. svcs should show:

bash-3.00# svcs |grep vnc

online 16:06:49 svc:/network/vnc1024/tcp:default

Have fun!

[Mar 24, 2007] freshmeat.net Project details for Enhanced TightVNC Viewer

Enhanced TightVNC Viewer 1.0.14 released. The Enhanced TightVNC Viewer package is part of the x11vnc VNC server project.
The Enhanced TightVNC Viewer package is part of the x11vnc VNC server project. It provides a native VNC viewer that takes advantage of new features in x11vnc, e.g. cursor alpha blending and automatic SSL tunnelling. Some features apply to any VNC server, e.g. automatic SSH tunnelling.

Another goal is to provide a package that conveniently bundles everything needed for the user to have the enhanced viewer running quickly.

This includes pre-built binaries of the viewer and utility programs for Windows and many Unix variants, and a GUI to configure and launch the viewer.

The short name for this project is "ssvnc", for SSL/SSH VNC viewer.

Release focus: Minor bugfixes

Changes:
Using port numbers lower than VNC's default port (5900) now works on Windows (for example, myhost.com:443).

Author:
Karl Runge [contact developer]  

[Dec 06, 2006] BigAdmin Description: How to enable XDM and VNC for Linux and Solaris

[Dec 06, 2006] Enhanced TightVNC Viewer TightVNC viewer enhanced with SSL tunnelling and other features.

C, Tcl, Unix Shell

The Enhanced TightVNC Viewer package is part of the x11vnc VNC server project. It provides a native VNC viewer that takes advantage of new features in x11vnc, e.g. cursor alpha blending and automatic SSL tunnelling. Some features apply to any VNC server, e.g. automatic SSH tunnelling. Another goal is to provide a package that conveniently bundles everything needed for the user to have the enhanced viewer running quickly. This includes pre-built binaries of the viewer and utility programs for Windows and many Unix variants, and a GUI to configure and launch the viewer. The short name for this project is "ssvnc", for SSL/SSH VNC viewer.

Free TridiaVNC Download

x11vnc a VNC server for real X displays  allows remote viewing and interaction with real X displays via keyboard and mouse.

Virtual Network Computing (VNC) Utility

  1. Short description and name of binaries
  2. Usage: how to start, how to use it
  3. Making the connection secure with SSH
  4. Official Documentation on local server
Let try to use VNC between two SUN machines (this do not make much sense but is good as a test):

Machine AA is the display server, i.e. your local one.
Machine BB is the application server, i.e. the remote one.

Please note: do NOT use ssh at this stage because VNC will not work then.

AA% rlogin BB
BB% top <== check that there is enough memory and CPU power
BB% vncserver :1

Comment:
The ":1" here means DISPLAY no. 1.
Please do NOT use display nr. 0 as this is already your present (telnet or rlogin) session.
In some special cases (for instance if you are running more then one vnc server) there is a conflict with the display numbering: just enter an higher number.
Check your ~/.vnc/server_name:1.log file to see if everything is OK
For instance this is a possible log file's name:
~/.vnc/sirrah.ee.ethz.ch:71.log for machine 'sirrah' and DISPLAY ':71'
The content of this file looks like this:

24/11/03 15:05:04 Xvnc version 3.3.3r1
24/11/03 15:05:04 Copyright (C) AT&T Laboratories Cambridge.
24/11/03 15:05:04 All Rights Reserved.
24/11/03 15:05:04 See http://www.uk.research.att.com/vnc for information on VNC
24/11/03 15:05:04 Desktop name 'X' (sirrah.ee.ethz.ch:71)
24/11/03 15:05:04 Protocol version supported 3.3
24/11/03 15:05:04 Listening for VNC connections on TCP port 5971
24/11/03 15:05:04 Listening for HTTP connections on TCP port 5871
24/11/03 15:05:04   URL http://sirrah.ee.ethz.ch:5871

If this is the first time that you are using vncserver then you will be asked to enter (define) a password.

You may want to check if the server is really running. Do it with the command:

ps -ef | grep Xvnc | grep -v grep

you should see something like this:
BB% ps -ef | grep Xvnc | grep -v grep
your_name 335 1 0 18:53:41 pts/4 0:01 Xvnc :1 -desktop X -httpd /usr/pack/vnc-3.3.3r1-rb/vnc_sun4_sosV_5.5/classes -a

in the case above we are using the display BB:1.0 (more about it later)
To kill the server program LATER on (but do NOT forget it), execute:
BB% vncserver -kill :1

you can now exit the application server leaving the VNC-server program running

BB% exit

Back on your local machine (here AA) starts the Viewer having the name of the server and the DISPLAY number as parameter:

AA % vncviewer BB:1
VNC server supports protocol version 3.3 (viewer 3.3)
Password:
VNC authentication succeeded
Desktop name "your_name's X desktop (BB:1)"
Connected to VNC server, using protocol version 3.3
VNC server default format:
8 bits per pixel.
True color: max red 7 green 7 blue 3, shift red 0 green 3 blue 6
Using default color map and translating from BGR233. Pixel format:
8 bits per pixel.
True color: max red 7 green 7 blue 3, shift red 0 green 3 blue 6
Got 8 exact BGR233 colors out of 256
Using 77 existing shared colors
 

On your screen you will see a big window which represent a desktop similar to the one that you would have if you would have logged on the application server's console.
In this big windows one xterm is already open and there you can start all the utilities you wish on the server.

How to choose the Desktop type

In the example above we used the default Desktop wich is the X one.
The VNC software create a subdirectory in your home directory called .vnc (note the "." bevore the name vnc). In this subdirectory there is a file called xstartup in which we can write the commands which starts a Desktop.

Default content for "~/.vnc/xstartup" is:

For X11 (tested and OK):
#!/bin/sh
xrdb $HOME/.Xdefaults
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

This will start a X-Desktop (and has been tested).

But you may want KDE or others. Here a list (please tell me your experience with it):

The two lines:

xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

can be added to each of the files below.

For KDE (tested and OK)(well this was in year 2000....):

#!/bin/sh
xrdb $HOME/.Xdefaults
/usr/sepp/bin/startkde-1.1 &

ATTENTION: recently we got problems with the command above.
PLEASE substitute the line with startkde-1.1 with:
launchx KDE

For fvwm2 (tested and OK):


#!/bin/sh
xrdb $HOME/.Xdefaults
/usr/sepp/bin/fvwm2 &

For CDE (tested ):

#!/bin/sh
xrdb $HOME/.Xdefaults
/usr/dt/bin/dtwm

VNC over SSH2 - A TightVNC Tutorial Van Emery - June, 2003

TightVNC:

Main Links

x11vnc a VNC server for real X displays

x11vnc allows one to remotely view and interact with real X displays (i.e. a display corresponding to a physical monitor, keyboard, and mouse) with any VNC viewer. In this way it plays the role for Unix/X11 that WinVNC plays for Windows.

I wrote x11vnc because x0rfbserver was basically impossible to build on Solaris and had poor performance. The primary x0rfbserver build problems centered around esoteric C++ toolkits. x11vnc is written in plain C and uses only standard libraries. I also added a few enhancements to improve the interactive response, add esoteric features, etc. The FAQ contains a lot of information and solutions to problems, but please feel free to contact me if you have problems or questions.

VNC (Virtual Network Computing) is a very useful network graphics protocol (applications running on one computer but displaying their windows on another) in the spirit of X, however, unlike X, the viewing-end is very simple and maintains no state. It is a remote framebuffer (RFB) protocol

Some VNC links:

For Unix, the VNC implementation includes a virtual X11 server Xvnc (usually launched via the vncserver command) that is not associated with a physical display, but provides a "fake" one X11 clients (xterm, mozilla, etc.) can attach to. A remote user then connects to Xvnc via the VNC client vncviewer from anywhere on the network to view and interact with the whole virtual X11 desktop.

The VNC protocol is in most cases better suited for remote connections with low bandwidth and high latency than is the X11 protocol (the exception is cached pixmap data on the viewing-end). Also, with no state maintained the viewing-end can crash, be rebooted, or relocated and the applications and desktop continue running. Not so with X11.

So the standard Xvnc/vncserver program is very useful, I use it for things like:

  • Desktop conferencing with other users (e.g. codereviews).
  • Long running apps/tasks I want to be able to view from many places.
  • Motif, GNOME, and similar applications that would yield very poor performance over a high latency link.

However, sometimes one wants to connect to a real X11 display (i.e. one attached to a physical monitor, keyboard, and mouse: a Workstation or a SunRay session) from far away. Maybe you want to close down an application cleanly rather than using kill, or want to work a bit in an already running application, or would like to help a distant colleague solve a problem with their desktop. This is where x11vnc is useful.

X11vnc Solaris 10 packaged on www.sunfreeware.com

x11vnc-0.7-sol10-sparc-local.gz x11vnc is a vnc server for X displays. It allows remote viewing and interaction with real X displays via keyboard and mouse - installs in /usr/local. This package also needs to have the following packages installed - zlib, jpeg, and /usr/local/lib/libgcc_s.so.1 from either libgcc-3.3 or gcc or later. You will need a vnc viewer on your client machines. I have tested the tightvnc java based viewers for Solaris and Mac OSX and will be offering a compiled version of the tightvnc vncviewer for Solaris here shortly.

x11vnc-0.7-sol10-intel-local.gz x11vnc is a vnc server for X displays. It allows remote viewing and interaction with real X displays via keyboard and mouse - installs in /usr/local. This package also needs to have the following packages installed - zlib, jpeg, and /usr/local/lib/libgcc_s.so.1 from either libgcc-3.3 or gcc or later. You will need a vnc viewer on your client machines. I have tested the tightvnc java based viewers for Solaris and Mac OSX and will be offering a compiled version of the tightvnc vncviewer for Solaris here shortly.

SV Solaris Management Console via VNC Cruz Walter Walter.Cruz "at" telenor.se
Fri Oct 29 13:51:01 2004


Hi!

I worked hard to get some Solaris stuff to work through VNC.
Some started with the wrong fonts so it was unreadable, some didn't even
start at all.

What I did to solve this was to tell the VNC-server to use a
font-server. X11 standard worked fine for me = xfs

Though I'm using a FreeBSD as main host, I'm not sure if the font-server
is the same in Solaris.
But the solution is the same, because Xvnc is not capable of reading ALL
fonts.

So instead of using a font-PATH, just use a xfont-server and give the
path to it.
Then the font-server will serve Xvnc with fonts, that did the magic and
I no longar have troubles with it.
How you call/configure the font-server is up to you system. Make a "man
X" it should say what standard Font-server are supposed to work for you. 
Then I supossed that u are running Xfree86. When you know how to config
the font server, then you just add the call to start the server in xstartup 
And then you tell your x-server to use a font-server instead of a
font-path.


// Walter


>Need some input on trying to get SMC 2.0 to run via VNC on Solaris 8.
VNC 
>works fine and all utils seem to work fine but everytime I try and
launch 
>SMC I receive the following - I get the initial image and it says 
>Initializing console..., Setting look and feel..., Initializing
console..., 
>Starting console... and then the images dies and the SMC server never
comes 
>up. Running SMC on the console works fine. My xstartup has been
modified so 
>that the window manager has been commented out. In this case, "#twm". I
have 
>appended the contents of the "/usr/dt/bin/Xsession" minus the
additional 
>"#!/bin/ksh" to the xstartup file. Any ideas are appreciated.
>
>_________________________________________________________________
>On the road to retirement? Check out MSN Life Events for advice on how
to 
>get there! http://lifeevents.msn.com/category.aspx?cid=Retirement

 VNC with CDE problems

mjm@wru.org mjm@wru.org
Thu, 25 Oct 2001 22:04:05 -0500


sure enough!

you need to set Xvnc owner/group/perms to match those of Xsun.

ie chgrp root;chmod 2775

also, if you want to run dtwm, you need to rip out all the useless stuff it
puts in the default startup script and just use Xsession.

/usr/openwin/bin needs to be in the path so things can be found, such as
Xauth.

I've got a little script that runs vnc:

#!/bin/ksh
PATH=$PATH:/usr/dt/bin
cd ~
vncserver -depth 24 -geometry 1152x900 :1

and /etc/init.d/vnc

#!/bin/ksh
#start and stop vnc sessions.
case "$1" in
'start')
     printf "Starting VNC servers for: "
	for a in /export/home/*/bin/vnc
	do
		cd ${a%%/bin/vnc}
		id=`pwd|sed -e 's-/export/home/--'`
		printf "%s, " $id
		su - $id bin/vnc&
	done
	printf "\n"
	;;

'stop')
      echo Stopping vnc sessions
	 ps -ef|grep -v awk|awk '/Xvnc :/ {print $9}'|while read session
      do
           /usr/local/bin/vncserver -kill $session
      done
	;;
*)
	echo "Usage: $0 {start|stop}"
	exit 1
	;;
esac
exit 0


and /etc/rc2.d/S99vnc:

#!/bin/ksh
#start and stop vnc sessions.
printf "Starting VNC servers for: "

case "$1" in
'start')
        /etc/init.d/vnc $1
        ;;

'stop')
      echo Stopping vnc sessions
         ps -ef|grep -v awk|awk '/Xvnc :/ {print $9}'|while read session
      do
           /usr/local/bin/vncserver -kill $session
      done
        ;;
*)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac
exit 0

(that little fiddly bit needed to get the init.d script to run under ksh)

all this so that vnc is up and running for everybody on the box right after
boot.

Sun Microsystems Support Forums

rhaertle wrote on Mon, 28 June 2004 15:40

Hello,

I am having trouble getting VNC working with JDS R2.

This is NOT remote desktop admin. I want to use the machine with no terminal.

I have done this with various other linuxes. Sometimes it works to start vncserver in a file in rc.d/init.d. The best way is to start vncserver as a service that executes Xvnc whenever there is a connection attempt on port 5900 or 5901 (add a line to /etc/services and an entry in inetd.conf or a file in xinetd.d).

I have tried a whole bunch of different stuff on JDS R2 without getting it to work.

Can anybody help? Again, this is not Remote Desktop the way it ships with the system.
 

On Suse you get to vnc via Launch->Preferences->Remote Desktop

That gives you a GUI to enable VNC server. You can also run: /usr/X11R6/bin/vncserver in a terminal 
it will setup fine. You'll need to provide a password. If you've run vnc with other Linux distributions, then this is no different than SuSE as far as VNC is concerned.

You can also run the command: vncviewer and it will ask for an IP and password to get a remote desktop.
It's pretty normal. You can also create a launcher for the viewer.

==========================

That approach won't solve the issue. The built-in "Remote Desktop" only allows remote access to a desktop that has already been started, and this PC has no running desktop.

Here's a reference that explains the theory, from Linux Mag's Guru Guidance column:
http://www.linux-mag.com/2003-03/guru_01.html

Running vncserver in a terminal is also not an option, since there is no desktop or terminal running. In an emergency, I can telnet or ssh to the machine, start vncserver by hand, and then access the machine via VNC, but that's too much trouble to do every day.

I want to start Xvnc automatically when the machine boots. The PC is without monitor, and vnc will be the only way I connect to it. I have done this with various other linuxes, I just haven't gotten it working in JDS. Sometimes it works to fire vncserver during startup (in an rc file), and sometimes it works to fire Xvnc via inet as a service when it gets a connect attempt on port 5900. I've even done it with xdmcp, but none of my attempts have worked in JDSR2.

If you can get this working, let me know. To test it, turn your machine on, and let it boot to rl5 (the display manager login screen). Then go to another machine, and connect to it via vnc.

Thanks.

rhaertle
Messages: 0
Registered: June 2004
Junior Member
 
I finally got this working. The machine is now running deadheaded with no monitor.

1) vnc is not installed in the default configuration. Don't pick it off the yast install list; I could not get the version shipped with JDS to work. I used realvnc. Download it as a tarfile. Run ./vncinstall to /usr/local/bin and /usr/local/man.

2) Use gdmsetup, or in /etc/X11/gdm/gdm.conf, set xdmcp Enable=true. By the way, while the system is coming up, you'll see init throw a "failed" message for gdm, I don't know why. This change is causing the failure, but everything seems to work. I'm not going to spend alot of time figuring out how to clean up whatever is reporting bad status, since it's running.

3) In /etc/services, add "vncserver 5901/tcp #vncserver". The 01 means screen :1. When the system gets a connect attempt on that port, it'll run the vnc server.

4) Using launch / prefs / system / sw & services / start & stop or edit inetd.conf to add the service. Add "vncserver stream tcp nowait root /usr/sbin/tcpd /usr/local/bin/Xvnc -once -securitytypes=none -inetd -query localhost". You can add -geometry and -depth if you want. You can add multiple lines here (inetd.conf) and to /etc/services for different geometries.

5) Load vnc into XF86. Use the XF86 config scripts, or in /etc/X11/XF86Config, add "load vnc" to the modules section.

Restart init and gdm or reboot. Now, when the machine boots, and you connect via vnc, you'll get a gdm login screen.

Don't do this unless your network is already completely secure.

ReVNC - X Windows

>OK.  I just downloaded the latest version of VNC. And it now works. At least
>you can connect now.  However it doesn't bring up KDE. It just has a terminal
>session running.  How would you go about getting it to start KDE or GNOME
>instead of the terminal session?

Yep, this is very normal.  Depending on how you start x you will get diffrent configuartions of window manager/etc...  Normally if you have xdm a script~ in /etc/X11/xdm called Xsession get run,  if you do a startx (which is a script itself),  it runs /etc/X11/xinit/xinitrc as the startup file.  THese startup files fire up a window manager, etc...  Becuase the window manager or session manager are components of an X environment, and not "integrated" into the graphics subsystem.  I don't know if you knew all that,  but some Windows-backgrounded people don't,  so I mention it for completeness.

When you run "vncserver" (which is a script that starts Xvnc), it looks in a sub-dir called .vnc in your home for a file called "xstartup", which it uses to build your prefered X environment (window/session managers, etc...).  If you wish this to be the same as when you login to the system locally make it a sym-link to /etc/X11/xinit/xinitrc, and that should do the trick.  Or else
you can hack "vncserver" to not bother with the home directory stuff at all and just start a certain window manager (which is what I do,  in fact, I have it start star office with no window manager at all).~

For those of you curious I have found that Star Office running to a remote X display eats about 15-20% of one of the CPU's even when idle and on another virtual desktop.  If I run it in a local Xvnc and then connect over a network with VNC, idle means idle, and it consumes no CPU resources when not in focus. Someone explain that on too me please?  (Not that I really mind, VNC with zlib compressesion uses alot less bandwith than X anyway).

Re: VNC - X Windows

I start a VNC server on Solaris like this: 

 vncserver -depth 8 -geometry 800x600 -cc 3 -query localhost -once

This gives me a normal CDE login screen.

My ~/.vnc/xstartup is empty. 
 

Recommended Links

TightVNC:

Main Links

Articles:

x11vnc:

Solaris 10

x11vnc-0.7-sol10-sparc-local.gz x11vnc is a vnc server for X displays. It allows remote viewing and interaction with real X displays via keyboard and mouse - installs in /usr/local. This package also needs to have the following packages installed - zlib, jpeg, and /usr/local/lib/libgcc_s.so.1 from either libgcc-3.3 or gcc or later. You will need a vnc viewer on your client machines. I have tested the tightvnc java based viewers for Solaris and Mac OSX and will be offering a compiled version of the tightvnc vncviewer for Solaris here shortly.

x11vnc-0.7-sol10-intel-local.gz x11vnc is a vnc server for X displays. It allows remote viewing and interaction with real X displays via keyboard and mouse - installs in /usr/local. This package also needs to have the following packages installed - zlib, jpeg, and /usr/local/lib/libgcc_s.so.1 from either libgcc-3.3 or gcc or later. You will need a vnc viewer on your client machines. I have tested the tightvnc java based viewers for Solaris and Mac OSX and will be offering a compiled version of the tightvnc vncviewer for Solaris here shortly.

 


	

 

.Xdefaults to helps to get nicer xterms

A sample .Xdefaults file

The .Xdefaults file can be used to define default values for many of the properties of X clients. The following example shows how some of the defaults for xterm and xclock may be defined.


# The following defaults change the behavior of clients using the
# X libraries

*background:    grey90
*foreground:    black
*
# The rest of the defaults are client specific

xterm*Foreground:       black
xterm*Background:       light grey
xterm*Border:           dark blue
xterm*ScrollBar:        on
xterm*TitleBar:         on
xterm*TextUnderIcon:    on
xterm*AllowIconInput:   on
xterm*AutoRaise:        on
xterm*termtype:         vt100
xterm*ttyModes:         intr ^c erase ^h susp ^@ dsusp ^@ kill ^u eof ^d

xclock*Foreground:      black
xclock*Background:      light grey
xclock*Border:          navy blue
xclock*Highlight:       cornflower blue
xclock*Hands:           slate blue
xclock*Mode:            analog

XTerm*geometry: 80x32

XTerm*scrollBar: on

XTerm*saveLines: 750

XTerm*Background: blue

XTerm*Foreground: white

*Font: -adobe-courier-bold-r-*-*-14-*-*-*-*-*-*-*

Xstartup

When setting up Solaris you will probably get a grey screen.  The Q&A suggest using a different desktop type.  For a full list of the options check:

http://www.ifh.ee.ethz.ch/~ballisti/computer_topics/docs/vnc_docs/vnc.html
<http://www.ifh.ee.ethz.ch/~ballisti/computer_topics/docs/vnc_docs/vnc.html>

CDE works well with vnc and is a prefered solution

The VNC software create a subdirectory in your home directory called .vnc (note the "." bevore the name vnc). In this subdirectory there is a file called xstartup in which we can write the commands which starts a Desktop.

Content for "~/.vnc/xstartup" is:

#!/bin/sh
xrdb $HOME/.Xdefaults
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
your_windows_manager &

For KDE


xrdb $HOME/.Xdefaults
/path_to_executable/startkde-1.1 &

For fvwm2

xrdb $HOME/.Xdefaults
/path_to_executable/fvwm2 &

For CDE):

xrdb $HOME/.Xdefaults
/usr/dt/bin/dtwm 
 

#!/bin/sh

xsetroot -solid grey

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#/usr/openwin/bin/twm &

/opt/gnome-1.4/bin/gnome-session &

 

Starting a VNC server

Once your password has been created you are ready to start a VNC server session. This session should run on a sun machine. You use a VNC client to connect to that session. You can modified the vncserver program to run a Xsession automatically. This will give you the default CDE environment. Here is an example:

softpano@sandbox $ vncserver -depth 24 -geometry 1280x1024

In the message that following that server will communicate that display number VNC will use, for example "New 'X' desktop is sandbox:1"

The vncserver program creates a default startup file in your personal ~/.vnc directory. This file runs Xsession to start CDE for you. The two command line arguments I used are all you will ever really need. The first, -depth 24, specifies that the VNC server start an X session at 24 bit color depth. If you run PC at 32 bit color depth,  you might want your VNC session and home PC's color depth to match, but you better not do that . Because of Solaris X-server-isms, you should use 24 bit color with vncserver if you run 24 or 32 bit color at home.  Yes, they do not exactly match, but programs like netscape won't work unless you do this.  The next command line option, -geometry 1280x1024, specifies that the VNC session desktop will be 1280x1024 in size. The default is 1024x768, but that might be too small for those with 21' displays :-).

If you use the Windows vncviewer program it is possible to specify that it use your whole Windows desktop, in which case you would want to start vncserver with the same resolution as your Windows desktop.

When you are finished with your VNC session, after reading the notes on exiting CDE and VNC below, you kill the vncserver like this:

softpano@sandbox rowland]$ vncserver -kill :1
Killing Xvnc process ID 3859
    

Login to the machine on which you started vncserver and kill it with the -kill display_number command line option. Yes, that display number has importance! There are important notes about running CDE and different window managers later on in this document. Please read them.

NOTE: You must login to the machine you started vncserver on. This means you have to connect to the specific host you ran vncserver on!

Users sometimes forget to kill their vncserver process, instead opting for starting yet another one. This unreasonably eats system resources. You might benefit from a wrapper script that checks there is a vncserver process running for you on the current Solaris login server. If there is, it tells you how to kill it. This is important to conserve resources. VNC login sessions consume a lot of resources.

One of the most important pieces of information about your VNC session is what display it is running on. When you started vncserver on the remote machine it printed out something like the following:

New 'X' desktop is sandbox:1    

In this case the VNC server is running on sandbox:1. Here :1 means display number 1. This number should be used in  vncviewer on your PC to connect to this host.    In Windows the vncviewer program has a GUI interface and you can right click on the taskbar and set some connection options (for example fullscreen).

The vncserver starts a small HTTP daemon that serves Java class files that your browser can execute if you connect it to the proper port:  http://vncserver_host:58nn     The vncserver_host is the remote host you started the VNC server on. The port specifies the display number. In my case I would connect to sandbox on port 5801, since my display was 01:

http://sandbox.softpanorama.org:5801
    

NOTE: It is possible to exit the vnclient and leave the server running remotely. You can then connect to it again, and everything is still running like you left it. This is a very cool feature.


Copyright © 1996-2007 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: March 15, 2008