BSD DevCenter
oreilly.comSafari Books Online.Conferences.

advertisement


Multi-Platform Remote Control
Pages: 1, 2, 3

I'll start my favorite windows manager, open an xterm and type "vncviewer." A small box appears that prompts for the "VNC Server." I can type in either the hostname or the IP address of the NT server; I decide to type in 10.0.0.3. Another box appears prompting for the password, so I type in the password I created when I set up the VNC server on the NT computer. At that point, the NT Server's desktop appears on my screen.



These two computers happen to be side by side on my network, so I'm now seeing the NT desktop in stereo. As I move the cursor on my FreeBSD box, I can watch it move simultaneously on both monitors. As my cursor goes to the Start menu and I see the ShutDown option, my mind wanders to all sorts of evil April Fools pranks I could play on unsuspecting users in my network. I envision the horror on another user's face as I slowly open a command prompt and type fdisk, or perhaps format c:. But seriously, VNC is an effective administrative tool. If you don't want users to access another computer, don't run the VNC server on it. If you don't want all users accessing a VNC server, set a tough password and only give it to authorized users.

Now, let's try running the VNC server on the FreeBSD computer and accessing it from the Win98 computer. Remember, whenever users connect to a VNC server, they will inherit the permissions of the user who started that VNC server. For this reason, don't start the VNC server as root. Also, keep in mind that if the user who starts the VNC server has permission to become the superuser, then so will the person who accesses the VNC server.

On the FreeBSD computer, I'll start the VNC server as the user genisis:

vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /home/genisis/.Xauthority
New 'X' desktop is genisis:1
Starting applications specified in /home/genisis/.vnc/xstartup
Log file is /home/genisis/.vnc/genisis:1.log

Note that I was again prompted for a password, just like I was when I started the VNC server on the NT computer. Several files were also created in genisis' home directory, including a log file for troubleshooting purposes. Take note of the number 1 as this is the number of the display that the client will make a connection to. If I was to repeat the vncserver command, then I would receive the same output, but with a display number of 2 and could repeat for as many connections as I was willing to listen for.

To ensure that the server is running, I can do a search through the running processes by greping the ps command like so:

ps -acux | grep vnc
genisis 20310  0.0  2.4  3556 3068  p0- I  8:36AM  0:00.20 Xvnc

You'll note that the actual name of the server is "Xvnc." Again, the owner of this process is "genisis" so any connections to this server will have all of the permissions of the user "genisis."

I'll also double check what port this server is listening on by searching through the socket table:

sockstat -4 | grep vnc
USER     COMMAND    PID  FD PROTO  LOCAL ADDRESS  FOREIGN ADDRESS      
genisis  Xvnc     20310   0 tcp4   *:6001         *:*                  
genisis  Xvnc     20310   3 tcp4   *:5901         *:*                  
genisis  Xvnc     20310   4 tcp4   *:5801         *:*

Note that the one process (PID 20310) is actually listening on three ports: 6001, 5901 and 5801. VNC uses the following numbering scheme for its ports:

  • 580x allows you to access the VNC server from a Web browser
  • 590x allows you to access the VNC server from a network connection
  • 600x means it is listening for x11 connections

In each case, the x represents the display number you were given when you started the VNC server; in our case it is 1.

Now that my FreeBSD box is listening for VNC connections, I'll go to the Win98 computer. When I unzipped the VNC program that I downloaded, a VNC folder was created. When I doubleclick on this folder, I see that it contains another folder called vncviewer that contains an executable called vncviewer. I'll doubleclick this executable, which will bring up the "Connection details" box that prompts me for the name of the VNC viewer in the format host:display. When I type in 10.0.0.1:1, I'll receive the "VNC Authentication" box, which prompts for the "Session password." Once I type this in, I'll receive a twm desktop with the following written in the blue title bar: genisis's X desktop (genisis:1)

Pages: 1, 2, 3

Next Pagearrow





Sponsored by: