Things look quiet here. But I've been doing a lot of blogging at
dan.langille.org because I prefer WordPress now.
Not all my posts there are FreeBSD related.
I am in the midst of migrating The FreeBSD Diary over to WordPress
(and you can read about that here).
Once the migration is completed, I'll move the FreeBSD posts into the
new FreeBSD Diary website.
VNC - allowing remote access to graphical desktops16 August 2002
VNC (an abbreviation for Virtual Network Computing) is a great client/server software package allowing remote network
access to graphical desktops.
TightVNC allows you to display X and Win32 desktops on remote X/Win32/Java displays.
In short, it will allow me to access my FreeBSD box from my Windows box via an X Windows interface (or the other way
around). That's something
I've want to do for a while. A friend had told me about VNC, so I went to FreshPorts
and did a search for vnc. I chose TightVNC.
You should consider the security implication of using VNC over untrusted networks, such as the Internet. If you plan
on using VNC over the Internet, you should use SSH or SSL to secure the session. The documentation will direct you to
the right place.
I already had an up to date ports tree, so I installed TightVNC with this single command:
cd /usr/ports/net/tightvnc
make install
My next step was to install the Windows client from the TightVNC download
area. Installation was straight forward and I won't document it here. It's Windows. What could go wrong?
But, should you need it, there is a TightVNC for Windows document.
In my situation, I'll be running the VNC Server on my FreeBSD box, and a VNC Client on my Windows box. You should
note that you can do this the other way around and access your Windows box from your FreeBSB box.
Starting the server
On my FreeBSD machine, I did this:
[dan@undef:~] $ which vncserver
/usr/X11R6/bin/vncserver
[dan@undef:~] $ vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /home/dan/.Xauthority
New 'X' desktop is undef.unixathome.org:1
Creating default startup script /home/dan/.vnc/xstartup
Starting applications specified in /home/dan/.vnc/xstartup
Log file is /home/dan/.vnc/undef.example.org:1.log
As you can see, the screen was set to 1024x768. I'll look at changing that resolution later.
The password you just entered must be supplied when you connect to the server.
This password can be changed by running vncpasswd on the server.
Stopping the server
From man vncserver, you will see:
-kill :display
Stops the session running on the specified display.
So to kill the server, I did this:
vncserver -kill :1
Killing Xvnc process ID 46791
where 1 is the value returned when you started vncserver.
Starting the client
In the following example, I will be using the TightVNC client. I also tried the VNC client from
http://www.uk.research.att.com/vnc/.
I'm running a client on my Windows box. You should read the TightVNC for Windows document first.
I started the VNC Client by clicking on Start->Programs->TightVNC->TightVNC Viewer (Fast Compression). I then entered the details
of my VNC Server (undef.example.org:1).
Then you will be prompted for the session password which you supplied when you started the VNC server. This
password can be changed by running vncpasswd on the server.
If all goes correctly, you should now be looking at an X session running on your FreeBSD box. Here's what it looked like
for me:
From here, it's just like you're on the FreeBSD box.
Changing the screen resolution
This was easier than I thought. First, I consulted the vncserver man page.
Then I supplied a value for geometry:
Starting applications specified in /home/dan/.vnc/xstartup
Log file is /home/dan/.vnc/undef.unixathome.org:1.log
[dan@undef:~/.vnc] $
Changing the Window manager
The window manager is started by the ~/.vnc/xstartup script. By default, VNCTight
uses twm as that is available on most Unix platforms. Here is the original script:
[dan@undef:~/.vnc] $ less xstartup.original
#!/bin/sh
My window manager of choice is KDE. To use that, I changed twm
to startkde. From then on, I got KDE on my VNC:
VNC Madness
You can connect to the same VNC server session from more than one VNC client. I tried this and fired up
more than one client. You can see the same thing happen in all clients.
WARNING: I've been told that if you connect to the VNC server from within a VNC Client, you will hang the system.