Auto starting vncserver at boot time any ideas

Shaun T O'leary shaun "at"
Wed, 09 Aug 2000 18:34:01 +0000

Here is an elegant solution using the Xservers file under RH6.2. It assumes the following:

xvnc binaries are in /usr/bin (use the /bin/env in the solaris and irix examples below
if they are in some other location)

Vnc java classes directory is /usr/lib/vnc/classes (tthis path is specified with the -http
argument- modify it if your classes directory is somewhere else)

vnc session password file is in /opt/vnc/.vnc passwd  (you can specify the
passwd file at a different location by modifying the -rfbauth entry below).

For RedHat Linux 6.2:

Append  /usr/X11R6/lib/X11/xdm/Xservers with the following line to start a
server on display :5...

:5 local /usr/bin/Xvnc :5 -httpd /usr/lib/vnc/classes -geometry 1152x900 -rfbwait 120000 -rfbauth
/opt/vnc/.vnc/passwd -rfbport 5905 -alwaysshared

(To use another display change :X and -rfbport 590X to match the display you
want to use)

Note: the -auth flag is NOT included as a flag to Xvnc because it is appended to the
command when the Xservers file is used to start display :5 (The standard X configuration
tacks a -auth argument on to the command in the xservers file when the native X
configuration is started. This lets the native OS handle the xauthority and magic cookies).

init 3 followed by init 5 on a console will restart both :0 and the new :5 (and others
if configured)

Using the Xservers file to start the  VNC X Server also gets you your default login
screen from KDM which allows you to login as you would from the console, and
when you complete a session, you can logout of the X window session and the
Xvnc server will restart with a login screen.

This same methodology should work under most unix flavors- and I use the
configuration under Solaris 2.6, Irix 6.5, and RedHat Linux 6.2. (HP configurations
are quite well documented on the vnc-list archive)

A couple of notes (I'll include Solaris and Irix as I've not seen this configuration
well documented on this list):

Some X configurations (Solaris 2.6 in particular) do NOT like non-standard
display geometry settings (1260x990 will give you a hosed dtlogin).

The vnc session password can be set as follows:

mkdir /opt/vnc /opt/vnc/.vnc
setenv HOME /opt/vnc

For solaris with dtlogin enabled(2.6- should work the same on others):
Vnc binaries are in /opt/vnc/bin and /usr/dt/config/Xservers contains

:5   Local local_uid "at" none root /bin/env PATH=/usr/sbin:/usr/bin:/usr/openwin/bin:/opt/vnc/bin  Xvnc :5
-httpd /opt/vnc/classes -geometry 1152x900 -rfbwait 120000 -rfbauth /opt/vnc/.vnc/passwd -rfbport 5905

As a single line- dtlogin will start the server with a dtgreet login session. Because root
owns the xserver (and the user owns the xsession after a sucessful dtlogin), there is
no concerns with the solaris /tmp/.X11-unix file permissions.

/etc/init.d/dtlogin reset

Should restart all of the Xservers (it doesn't always handle the console well under 2.6)
If it doesn't work, the microsoft solution will- reboot.

For Irix and XDM:
Vnc binaries are in /opt/vnc/bin and and /usr/lib/X11/xdm contains:

:5 secure  bin/env PATH=/usr/sbin:/usr/bin:/opt/vnc/bin  Xvnc :5  -httpd /opt/vnc/classes -geometry 1152x900
-rfbwait 120000 -rfbauth /opt/vnc/.vnc/passwd -rfbport 5905 -alwaysshared

As a single line.

All three of these solutions use the native X startup process to start vnc without
requiring any scripting.

/etc/init.d/xdm stop
/etc/init.d/xdm start

Will restart the servers under Irix.

Really bad security problems exist if the -rfb flags are not set: anybody can connect
to the vncserver without providing the VNC password...

Keep in mind that if your vnc paths exist on a shared filesystem (great for keeping current
copies on all platforms) that the shared filesystem must be mounted prior to the xserver
starting: dtlogin by default on solaris starts in rc2.d and nfs/dfs/afs start in rc3.d (move
/etc/rc2.d/S99dtlogin to /etc/rc3.d/S99dtlogin).

- --- Jelle Beusen <beusen25 "at"> wrote:
> Hi there,
> well alot of people have asked this but I have yet to see an answer..on the
> list hat is.
> I have RH linux 6.2 and wanne auto start vncserver at boot time without
> logging in to my system.
> I have tried various options but so far I could get closest with a simple
> script with expect in my /usr/bin dir.
> has anybody done it and if so mind sharing it with all of us please I have
> been hacking away at this all day now and no results !!
> Thanx.
To unsubscribe, send a message with the line: unsubscribe vnc-list
to majordomo "at"
See also: