TightVNC
![]() |
Post Page Rank |
At work I have a Desktop PC : 4GB Ram , quad core , etc (which is much more powerful than my laptop) , with FreeBSD. On my laptop I also have FreeBSD but sometimes I need to access remotely my desktop PC. Until now ssh -X was a solution but not an elegant one, so I’ve decided to use a VNC solution. After a little research on google I found TightVNC and decided to give it a try…
The installation was as simple as :
/usr/ports/net/tightvnc && make install clean
The first time you run vncserver you will be asked to setup a password and the server will start. The annoying part is that tightvnc doesn’t automatically start at boot, you need to start it yourself .. so I’ve written a little script to do that (/usr/local/etc/rc.d/vncserver.sh ) where 1280×768 is the resolution that the remote desktop will have :
#!/bin/sh
#
# This script starts/stops vncserver
#. /etc/rc.subr
name=”vnc”
vncserver_display=”:1″
vncserver_options=”-geometry 1280×768 -compatiblekbd -fp ‘/usr/X11R6/lib/X11/fon\
ts/misc/,/usr/X11R6/lib/X11/fonts/75dpi/,/usr/X11R6/lib/X11/fonts/100dpi/’”rcvar=`set_rcvar`
start_cmd=”${name}_start”
stop_cmd=”${name}_stop”load_rc_config $name
eval “${rcvar}=\${${rcvar}:-’NO’}”
vnc_msg=${vnc_msg:-”Starting vncserver…”}vnc_start()
{
echo “$vnc_msg”
PATH=/usr/X11R6/bin:/usr/local/bin:$PATH
su dante -c “/usr/X11R6/bin/vncserver ${vncserver_display} ${vncserver_options}\
”
}
vnc_stop()
{
echo -n $”Shutting down VNC server: ”
su dante -c “vncserver -kill :1″ >/dev/null 2>&1
}run_rc_command “$1″
Just create the same script in /usr/local/etc/rc.d and :
chmod 755 /usr/local/etc/rc.d/vncserver.sh
echo ‘vnc_enable=”YES”‘ >> /etc/rc.conf
Now all you need to do is edit ~/.vnc/xstartup according to your needs, below you can see the content of my ~/.vnc/xstartup :
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
fluxbox &
where fluxbox is the WM that I’m using.
In order to remotely connect to your vnc server just install tightvnc on the PC/laptop you wish to connect with and run vncviewer In the VNC server field just type the remote hostname ( your.vncserver.tld:1 ), chose the compression level and your’re done.







