BSD Stuff
TightVNC server on Freebsd over ssh
26 April 2007, 14:21
I installed TightVNC sever on my system today so that I can get remote access to X Windows.
Here is my little howto on it.
There are only 3 things that I needed to get for this to work, TightVNC from the FreeBSD ports tree, TightVNC for Ms Windows for connecting from MS Windows and PuTTY to connect trough a ssh tunnel.
Just a thanks to Dan Langille at The FreeBSD Diary for his howto. I mostly followed what he did on his site.
The first thing I did was to install TightVNC on the FreeBSD box by doing
# cd /usr/ports/net/tightvnc; make install clean
after that you can logout as root and start the VNC server by typing in this
> vncserver
The first time you are running the server it will ask you to create a password. You can always change the password afterwards by running vncpasswd.
To see if its running and get some info out of the server run this
> ps auxww | grep vnc
it should out put something similar to this
hamba 88151 0.9 1.7 9796 8836 p2 S 7:32PM 0:00.09 Xvnc :1
-desktop X -httpd /usr/X11R6/share/tightvnc/classes -auth
/home/hamba/.Xauthority -geometry 1024x768 -depth 24 -rfbwait
120000 -rfbauth /home/hamba/.vnc/passwd -rfbport 5901
To kill the vncserver you can use the following command where 1 is equal to Xvnc :1.
> vncserver -kill :1
Now that you have vncserver running you can go and download the TightVNC MS Windows client and PuTTY from the links abof.
After you have installed it you need to create a ssh tunnel trough PuTTY to Source port 5901 and Destination localhost:5901 as the picture below shows.

The reason for choosing that port number to do the tunnel, is because when you have a look at the output from ps you will see that Xvnc :1 is equal to display 1 and the standard port is 5900 so at the end of the ps out put you see rfbport 5901. This is what we will use in the VNC Client to connect to the server.
Now launch the TightVNC Viewer (fast compression) and in the connection box type in localhost::5901.

It will ask for a password, this is the password that you chose at the installation of TightVNC on the FreeBSD box.
After you typed in your password, it should start up and you will see the default twm windows manager with xterm running.
You can go and change this by editing this file ~/.vnc/xstartup, this file is very much like the ~/.xinit file in that it starts the prefered windows manager and any application that you want to run at startup of X Windows.
Page 1 of 1