Thursday, July 23, 2009

VNC & XDMP Configuration in OpenSolaris

My requirement was to be able to connect my VNC client to a system running OpenSolaris 2009.06 and to be able to login as root.

1. Check that the VNC Server is Installed

This should be present as it is part of the 2009.06 binary distribution, but I checked anyway.


# pkg info SUNWxvnc
Name: SUNWxvnc
Summary: X11/VNC server
State: Installed
Authority: opensolaris.org (preferred)
Version: 4.1.3
Build Release: 5.11
Branch: 0.111
Packaging Date: Fri Jun 13 17:49:25 2009
Size: 3.66 MB
FMRI: pkg:/SUNWxvnc@4.1.2,5.11-0.91:20080613T174925Z

2. Add this line to /etc/services

vnc-server 5900/tcp # Xvnc

3. Edit /etc/X11/gdm/custom.conf as below

[xdmcp]
Enable=true
[security]
DisallowTCP=false
AllowRoot=true
AllowRemoteRoot=true

4. Enable the Services

# svcadm enable xvnc-inetd
# svcs xvnc-inetd
STATE STIME FMRI
online 16:22:30 svc:/application/x11/xvnc-inetd:default
# svcadm enable gdm
# svcs gdm
STATE STIME FMRI
online 14:43:13 svc:/application/graphical-login/gdm:default

5. Connect to the Display with a VNC Client


You should now be able to connect to :5900 and you should see the gdm login screen.


If you cannot connect, try stopping & starting the services:

# svcadm disable xvnc-inetd gdm
# svcadm enable xvnc-inetd gdm

6. Making the Session Persist

This may or may not be desirable for you, but if you want the VNC session to persist if you exit the VNC client then do the following:

# svccfg -s xvnc-inetd

svc:/application/x11/xvnc-inetd> editprop

This take you into a vi session. Look for the line...

#setprop inetd/wait = boolean: false

Copy the line, uncomment it and set it to true. Save the file, exit svccfg and run the command...

# svcadm refresh xvnc-inetd

7. To set the VNC password just use the vncpasswd command:

pfexec vncpasswd /etc/X11/.vncpasswd


Then

Stop and restart the service:

svcadm disable xvnc-inetd gdm
svcadm enable xvnc-inetd gdm


Connect again with you VNC client. Now, when you exit/kill the VNC client, the session on the server will persist and you will be able to connect to it again.