Script to Configure VNC Server in Solaris 10 5/08 and Solaris Express (Nevada)

I have been using a script for a while to configure VNC server displays for Solaris Express (Nevada) and I just found out that the same script works on Solaris 10 5/08 (Solaris 10 Update 5) as it includes Xvnc also.

I always do a  full install of Solaris. If you don't, then maybe Xvnc will not be installed on your system. You can easily check:

# pkginfo | grep  xvnc
system      SUNWxvnc                         X11/VNC server

You run the below script once after OS installation is complete. It sets up two VNC displays and you connect to them with a  VNC client as <hostname>:1 and <hostname>:2 . The second display is shared.

#!/bin/sh
#
# config_Xvnc_s10+snv.sh
#
# Run this script once after OS installation is completed.
#
# This has been tested with Solaris 10 5/08 and Solaris Express (Nevada) b87 onwards
#

#add vnc display 1
svccfg -s application/x11/x11-server add display1
svccfg -s application/x11/x11-server:display1 addpg options application
svccfg -s application/x11/x11-server:display1 addpropvalue options/server astring: "/usr/X11/bin/Xvnc"
svccfg -s application/x11/x11-server:display1 addpropvalue options/server_args astring: '"SecurityTypes=None"'

#add vnc display 2, which is shared
svccfg -s application/x11/x11-server add display2
svccfg -s application/x11/x11-server:display2 addpg options application
svccfg -s application/x11/x11-server:display2 addpropvalue options/server astring: "/usr/X11/bin/Xvnc"
svccfg -s application/x11/x11-server:display2 addpropvalue options/server_args astring: '"SecurityTypes=None"'
svccfg -s application/x11/x11-server:display2 addpropvalue options/server_args astring: '"-alwaysshared"'

# Configure dtlogin to start it
if [ ! -d /etc/dt/config ] ; then
        mkdir -p /etc/dt/config
fi
if [ ! -f /etc/dt/config/Xservers ] ; then
        cp /usr/dt/config/Xservers /etc/dt/config/Xservers
fi

echo "   :1   Local local_uid@none root /usr/X11/bin/Xserver :1" >> /etc/dt/config/Xservers
echo "   :2   Local local_uid@none root /usr/X11/bin/Xserver :2" >> /etc/dt/config/Xservers

pkill -HUP dtlogin

#End

The displays persist when you disconnect the VNC client, so you can come back to a session at  later time and all the windows and applications will be as you left them. Any jobs you kicked off will have continued to run.

You can get VNC client software from http://www.realvnc.com. There is a Free Edition and an enhanced Personal Edition for which you need a license.

If you have an older release of Solaris 10 than 5/08 then take a look at my earlier blog entry about how to configure VNC.

References: 1, 2

Comments:

Thank you!

Posted by Philip Ngai on July 07, 2008 at 07:42 PM BST #

Thanks a lot! Fast and easy.

Posted by guest on August 26, 2008 at 11:31 PM BST #

How can I make it require a log in?

If go to my Solaris 10 u5 box via IP:port from one machine with RealVNC, and give Solaris my login and password, any one can go to the IP:port and be logged in, watching everything I do.

Is there some way to make VNC require a login? Your script has "SecurityTypes=None".

Or how do I do it?

VNC to GUI Solaris works great, but I don't want to leave my system wide open.

thank you

Posted by Stairbuilder on September 02, 2008 at 02:12 PM BST #

How can I make it require a log in?

If go to my Solaris 10 u5 box via IP:port from one machine with RealVNC, and give Solaris my login and password, any one can go to the IP:port and be logged in, watching everything I do.

Is there some way to make VNC require a login? Your script has "SecurityTypes=None".

Or how do I do it?

VNC to GUI Solaris works great, but I don't want to leave my system wide open.

thank you

Posted by Stairbuilder on September 02, 2008 at 02:16 PM BST #

How can I make it require a log in?

If go to my Solaris 10 u5 box via "IP:port" from one machine with RealVNC, and give Solaris my login and password, anyone can go to the "IP:port" and be logged in, watching everything I do.

Is there some way to make VNC require a login? Your script has "SecurityTypes=None".

Or how do I do it?

VNC to GUI Solaris works great, but I don't want to leave my system wide open.

thank you

Posted by Stairbuilder on September 02, 2008 at 02:22 PM BST #

Did I just waste the last 30 minutes typing up my comment??? The page has been loading for 5 minutes now. !!! I went to a new machine to post this.

Posted by fred on September 02, 2008 at 02:26 PM BST #

okay, it just takes a looooooooooooooooong time to post.

Posted by fred on September 02, 2008 at 02:38 PM BST #

Is there any way to change the default 1024x768 screen size to 1280x800 or any other screen resolution when using vncviewer or thightvnc viewer?
Thanks...

Posted by Ubersol on September 25, 2008 at 09:44 AM BST #

Also, is there any way to increase security with some kind of a password setting with svccfg?

Posted by ubersol on September 28, 2008 at 06:24 PM BST #

To enable a password protection (for vnc login, not user login) that will prompt at every vnc session, make the following changes.

1.) Either remove the SecurityTypes property using command:
# svccfg -s application/x11/x11-server:display1 delprop options/server_args
or just don't add the property in the first place.

2.) Add "-rfbauth /etc/.vnc/passwd" to the entry(s) that you want password prtected in /etc/dt/config/Xservers file.

3.) Create vnc passwd:
# mkdir /etc/.vnc
# vncpasswd /etc/.vnc/passwd
enter the VNC password

Posted by Euan Thoms on October 30, 2008 at 12:51 AM GMT #

I've used this script a few times now, works great. Thanks for posting it.

Posted by grimsy on November 05, 2008 at 09:22 PM GMT #

I just ran this script and added the extra bit requiring a password on my X4150 running Solaris 10 5/08. I have tried connecting to the server using my laptop on port 5900 and I get a "connection refused" message. I have checked the /etc/dt/config/Xservers file and I see the couple of lines added. I rebooted the server ... still no luck. Any ideas?

-j

Posted by Jeff Milton on November 14, 2008 at 07:50 AM GMT #

Okay did a svcs -a and found something interesting:

uninitialized 9:15:38 svc:/application/x11/x11-server:display1
uninitialized 9:15:38 svc:/application/x11/x11-server:display2

So how do i bring these online?

Posted by Jeff Milton on November 14, 2008 at 08:00 AM GMT #

So I thought I was being all smart and I did this:

# svcadm -v enable x11-server:display1
svc:/application/x11/x11-server:display1 enabled.
# svcadm -v enable x11-server:display2
svc:/application/x11/x11-server:display2 enabled.
# svcs -a

And ended up with this:
maintenance 10:24:45 svc:/application/x11/x11-server:display1
maintenance 10:24:56 svc:/application/x11/x11-server:display2

I still cannot access with a remote vnc client.

Posted by Jeff Milton on November 14, 2008 at 08:26 AM GMT #

Checked log file at: /var/svc/log/application-x11-x11-server:display1.log
and
/var/svc/log/application-x11-x11-server:display2.log

Fatal server error:
Server is already active for display 0
If this server is no longer running, remove /tmp/.X0-lock
and start again.

[ Nov 14 10:24:45 Stopping because all processes in service exited. ]
[ Nov 14 10:24:45 Executing stop method (:kill) ]
[ Nov 14 10:24:45 Restarting too quickly, changing state to maintenance ]

Posted by Jeff Milton on November 14, 2008 at 08:35 AM GMT #

Deleted the .X0-lock file and
svcadm -v enable x11-server:display1
svcadm -v enable x11-server:display2

svcs -a still shows maintenance mode.

I'm out of ideas ... help.

Posted by Jeff Milton on November 14, 2008 at 08:40 AM GMT #

Hi Jeff. I am sorry but I don't have access to any equipment to test this out. Maybe someone else watching this thread can help. Rgds, Tim

Posted by Tim Thomas on November 14, 2008 at 12:48 PM GMT #

Thanks for this script. Works great.

Just one question: How do we configure tcp_wrappers for this?

Would be as simple as adding another line, after having enabled tcp_wrappers for inetd? Ending similar to: ...server_args astring: '"-inetd"'

Posted by Dave on December 04, 2008 at 09:26 AM GMT #

Hello!
I am new to solaris10, iwant to make VNC to my server T5220, first pakg check commands give the requried result in the document. I am unable to run !/bin/sh, i am root while doing allthis.
#!/bin/sh
#
# config_Xvnc_s10+snv.sh
Do i need to install VNCsoftwarefor solaris10? It is poor question but need help.
Regards,
ahmad

Posted by ahmad on December 27, 2008 at 11:50 PM GMT #

Hi Ahmad. Assuming that you are running Solaris 10 Update 5 and the Xvnc package is there then all you should need to do is save the script I have provided into a file and make it executable. Are you familiar with shell scripts ? Rgds, Tim

Posted by Tim Thomas on December 28, 2008 at 02:23 AM GMT #

When you set up displays, the port to access those displays should be port 59XX where XX is the display number. Therefor display :1 would be port 5901 and display :10 would be port 5910.

Posted by Charles on March 27, 2009 at 07:40 PM GMT #

To fix maintenance mode issue

svcadm -v disable x11-server:display1
svcadm -v disable x11-server:display2

svcs -a will shows them in disable mode.

Deleted the .X0-lock file and
pkill -HUP dtlogin

Posted by vlinx on May 26, 2009 at 04:44 PM BST #

Post a Comment:
Comments are closed for this entry.
About

Tim Thomas

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today