Defcon1-Header
Tool-BarfreeBSD ArticlesSearch Our SiteHOMEfreeBSD LinksContribute to FreeBSD HelpFreeBSD FilesFreeBSD Script Corner

VNC How-To Article

Introduction
VNC stands for Virtual Network Computing, which is used to view your desktop remotely from anywhere over the network using a java enabled browser or vncviewer. VNC is available for download for varieties of operating systems and platforms.

Install
In FreeBSD, VNC is available as a port that is located under /usr/ports/net/vnc and installs vncserver and vncviewer.

Installing the port:
# cd /usr/ports/net/vnc
# make install
>> vnc-3.3.3r2_unixsrc.tgz doesn't seem to exist in /usr/ports/distfiles/.
>> Attempting to fetch from http://www.uk.research.att.com/vnc/dist/.

Receiving vnc-3.3.3r2_unixsrc.tgz (2072772 bytes): 100%
[&configure&compile&install&]
===>  Registering installation for vnc-3.3.3r2
#

Setting up the VNC Server
Before starting the VNC server, we must first specify a password to logon to the VNC session and make an X init script in /home/user/.vnc/xstartup
$ vncpasswd                             <-Set password for VNC session
Password:
$ vncserver -depth 24 -geometry 1024x768    <- Starts vncserver at a depth of 24bits at 1024x768
 New X desktop is hostname:1               <- Now ready to connect to server. **

  Starting applications specified in /home/user/.vnc/xstartup
  Log file is /home/user/.vnc/user:1.log

$ vncserver -kill :1                         <- Kills the VNC server running on display 1

** Server automatically assigns the lowest available display number or you can specify your own by typing in vncserver :9 -depth 24 -geometry 1024x768 which will start a server at display #9.

 Connecting to your desktop

From a remote FreeBSD box running X:

Command format is vncviewer <Hostname or IP>:<Display #> ex. vncviewer my.host.com:1
Doing this will ask you for the password and start the VNC session.

From a remote Windows box:
Download the Win32 binary package which includes vncviewer and winvnc (server app)

With a Java enabled browser:

Ok VNC server runs a small web server that allows anyone with a java enabled browser to log in to their VNC session. The webserver runs at port 58xx where xx is the display number. If your hostname is my.host.com and display number is 1 then you would connect by typing http://my.host.com:5801/ .

UPDATE : 05-22-01

You might want to add something to that VNC on making
it work with xdm.

basically all you need to do is add a line or two to

/usr/X11R6/lib/X11/xdm/Xservers

mine looks like:

:0 local /usr/X11R6/bin/X
:12 local /usr/X11R6/bin/Xvnc :12 -broadcast -dontdisconnect -desktop
'low' -depth 8 -geometry 640x480
:13 local /usr/X11R6/bin/Xvnc :13 -broadcast -dontdisconnect -desktop
'high' -depth 16 -geometry 800x600

the :12 and :13 denote the 'screen' xdm will use as well as the port vnc
will use. In this scenario xdm will listen on 6012 and 6013, vnc on 5912
and 5913. I have two sessions setup, one for low bandwidth use and one for
higher bandwidth use. You can additionally specify the -rfbauth <passwd
file> option for Xvnc. This will prompt for vnc password before
connecting. The user will then have to enter normal user and password.
This is useful if you dont want everyone with an account to use vnc. You
can make a common vnc passwd file so that you must know the 'vnc password'
to connect. BEWARE: DO NOT FORGET TO LOGOUT, ELSE SOMEONE WILL COME STEAL
YOUR SESSION. you also may want to look into the -rfbwait option, i have
tried it yet, but i think you may be able to set a timeout.

the -dontdisconnect option is important:

-dontdisconnect    don't disconnect existing clients when a new
non-shared   connection comes in (refuse new connection instead)

see Xvnc -help for more options and explanation of options.

if you have gotten the -inetd option to work yet, i'd love to know. in
theory you could allow multiple sessions on the same port.


By Patrick Li - patli on EFnet

© 1997 - 20013 Defcon1, www.defcon1.org , Copyrights for all materials on this web site are held by the individual authors, artists, photographers or creators. Materials may not be reproduced or otherwise distributed without permission of www.defcon1.org and the content's original author.

Defcon1-Header2
Tool-Bar-2Defcon1  Webmail