Collaborating Over the Network


While sharing files allows people to work on different parts of large projects concurrently, everyone still works on independent pieces. For real productivity, nothing beats an occasional meeting. This allows people to identify problems, understand issues, and address details. Meetings can also be used as a teaching forum and used to spread knowledge.

Note 

Too many meetings can impede productivity. Lots of companies (and projects) get into situations where they spend more time talking than actually doing work.

In today's online world, physically getting people together is not always practical. Some people work at home, some are in other countries, and some people are too lazy to walk across the hallway. VoIP and IM can provide real-time communication, but they don't let you see what is really going on. This is where sharing desktops comes in. It's one thing to describe a problem in an e-mail or over the phone; it's another to actually show it. When working together, a shared desktop allows everyone to actually see what is going on. Under Ubuntu, Virtual Network Computing (VNC) is the best option for sharing desktops.

VNC is supported on Unix, Linux, Mac OS X, and Windows operating systems. Rather than struggling with almost-compatible software, VNC provides access to remote desktops where you can use software on its native platform. For example, I frequently find myself in phone conferences where Microsoft NetMeeting or LiveMeeting is used to shares slides. This is convenient for Windows users, but not for Linux users. To get around this problem, VNC is started on one of the Windows clients. This way, Linux users can use VNC to watch the shared presentation.

VNC consists of two parts: a server and one or more clients (called viewers). The server shares the desktop, while the client creates a window to display the server's desktop.

Warning 

Under Microsoft NetMeeting, the server can choose which windows to share. Under VNC it is all or nothing; either the entire desktop is shared or nothing is shared. If you are sharing your desktop, don't forget that everyone can see you checking your e-mail.

image from book
Remote Desktops

There are a couple of different ways to share desktops between Windows and other systems. Although VNC is very common and accessible, other options exist. For example, Microsoft offers the Remote Desktop Protocol (RDP) for sharing the desktop with a remote host. RDP is included by default on Windows 2003 and XP systems, and is available from Microsoft for other Windows versions (http://msdn.microsoft.com/library/en-us/termserv/termserv/remote_desktop_protocol.asp). On the Linux and Unix side, tools such as rdesktop (part of the default Ubuntu desktop) allow access to the shared Windows desktop from non-Windows systems. To use this program, you just need to provide the name of the windows server-for example:

     rdesktop winserver 

Other RDP client packages for Ubuntu include gnome-rdp and tsclient. For the KDE desktop, there is also krdc.

Although using a native Microsoft protocol is useful for accessing a Windows desktop, there are two significant limitations. First, the RDP server (shared desktop) is not available for all versions of Windows; second, only Windows can be a server. Currently, you cannot use any of these Ubuntu RDP tools to share your Ubuntu desktop with a Windows system.

image from book

Using the VNC Viewer

The VNC client for Ubuntu is provided by the xvncviewer package and is installed as part of the Ubuntu desktop. To use it, run: vncviewer. This pops up a small window that asks for the server's name.

Tip 

I usually add the VNC viewer as a launcher on the top panel. This way, you can click on an icon and immediately get prompted for the server's name. If you include the server's name on the command-line, then vncviewer will immediately connect to the server.

VNC servers can be configured to require password. If one is needed, you will be prompted to enter it. Then the viewer's window will appear, showing you the shared desktop (see Figure 6-6). While your mouse is over the viewer, your cursor will become a small square. If the server allows you to interact (and not just "view only"), then the server's cursor will follow you. Every keystroke and every mouse click will be transmitted from your system to the server.

image from book
Figure 6-6: Using VNC to access a remote server. The remote VNC server's desktop is displayed within the VNC window.

Even more importantly, the clipboard buffers on the server and client are linked. This enables you to copy and paste text between applications on the client and everything on the server.

Note 

If the server's desktop resolution is larger than the client's window, then the viewer's window will have scrollbars. This can be inconvenient. Also, if the server's color palette differs from the client's, then colors may look wrong.

Sharing Your Desktop

For an Ubuntu VNC server, there are two options. First, you can share your own desktop. In this setup, every client sees everything you have. Although this is usually not a problem, it can sometimes hinder your own productivity. For example, you can't search the web or check e-mail in privacy if everyone can see your desktop. The second option is to share a virtual desktop, where clients only see what you want them to see.

Sharing Your Complete Desktop

To share your complete desktop, you will need to install the server, x11vnc.

 sudo apt-get install x11vnc 

To start the server, simply run x11vnc. The basic server uses no passwords, allows one client to fully interact with the server, and exits when the client disconnects. There are many other options for x11vnc. Table 6-1 shows some of the more useful ones. These options can be combined. I usually use something like x11vnc -forever -passwd SeCrEt.

Table 6-1: Command-line options for X11vnc
Open table as spreadsheet

Option

Example

Purpose

passwd

x11vnc -passwd SeCrEt

Assign a password to the server. It's not very secure, but it does keep the riff-raff out.

viewonly

x11vnc -viewonly

All clients can watch but cannot interact. This is useful for presentations.

forever

x11vnc -forever

The server continues running after the last client disconnects. The default setting is -once.

clip

x11vnc -clip 600x400+25+0

Restrict the desktop region. In this case, it is 600x400 pixels offset vertically 25 pixels- this is a region just below the top panel. Only items within this region are shared.

Sharing Independent Desktops

Although sharing your full desktop is useful, sometimes it is better to have a clean slate for sharing. X-Windows supports virtual desktops. These are desktops that exist in memory and do not conflict with your real desktop. The tightvncserver package provides a virtual desktop for sharing over VNC.

  1. Install the Tight VNC server.

     sudo apt-get install tightvncserver 
  2. Start the server. Be sure to specify the screen resolution (e.g., 800x600), color depth (e.g. 8, 16, or 32 bit), and the display number. Your normal desktop runs on display ":0", so you will need to choose an alternative display.

     vncserver -geometry 800x600 -depth 16 :9 
    Tip 

    Although you can specify a desktop space that is larger than your real desktop and uses a higher resolution, don't. In most cases, it is more convenient to choose a geometry that is smaller than your desktop and has the same color depth (or less) to avoid scrollbars and ugly colors.

  3. When you first start vncserver, it will ask you for a password. Clients will need to provide this when connecting to the server. If you restart the server, you won't need to specify the password. If you want to change the password later, use vncpasswd.

  4. Use xvncviewer to connect to the server. For the server's name, include the display. For example, if the server's hostname is vserver then type in vserver:9.

The virtual desktop starts up in the background. To stop it from running, use the -kill option. For example, vncserver -kill :9.

The basic virtual desktop has a very simple configuration: it has one terminal window open. There are no menus, no icons, and no background beyond the default X11 "gray". The desktop is defined in the $HOME/.vnc/xstartup script. You can change this in order to give it a real desktop. For example, Listing 6-3 shows my xstartup. It has options for many different desktops, but currently starts up my Gnome desktop without showing any of the actual applications I have open (see Figure 6-7).

Listing 6-3: Sample $HOME/.vnc/xstartup with Different Desktops

image from book
 #!/bin/sh ################################################### # Select your desktop (only uncomment one window manager) ################################################### ######################################### ### For *your* Gnome Desktop gnome-session --sm-disable & ######################################### ### For KDE (after: sudo apt-get install kubuntu-desktop) #startkde & ######################################### ### For Tab Window Manager (after: sudo apt-get install twm) #twm & ######################################### ### For plain X-Windows with a terminal #xrdb $HOME/.Xresources #xsetroot -solid grey #x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #x-window-manager & ################################################### ### Add your own applications here. ### Be sure to background them using "&" 
image from book

image from book
Figure 6-7: Tight VNC server running the Gnome desktop. The real Gnome desktop has applications running that do not appear in the VNC server.

Tip 

When using Firefox on the VNC virtual desktop, you may see errors about Firefox already running or the profile being in use. Consider using firefox –no-xshm or an alternate profile to overcome this problem. See Chapter 5 for tuning Firefox.

Securing VNC Connections

The VNC password provides a basic level of security, but should not be trusted for safety over the Internet. Instead, you can tunnel VNC over an SSH connection. By default, the VNC server uses port 5900/tcp. Each VNC display increments this value. For example, if you are using Tight VNC and specify display :9, then the port is 5909/tcp. Then, using SSH port forwarding, you can tunnel the VNC port. For example, to tunnel the local VNC port to the server's VNC server running on :9, use:

  1. On the remote server, start the Tight VNC server on display :9. For example:

     vncserver :9 
  2. On your local system, use SSH to connect to the server and forward the local port 5900/tcp to the server's port 5909/tcp.

     ssh -L5900:localhost:5909 server 
  3. In a different window on your local system, start the VNC client with:

     xvncviewer localhost 

    This command tells the viewer to connect to the VNC server located on localhost:5900. However, 5900/tcp is actually tunneled through the SSH connection to the remote server. The connection is tunneled to the server's port 5909/tcp where the VNC server is running.

By tunneling VNC over SSH, you prevent attackers from seeing your desktop and, more importantly, you do not need to have the VNC server and its weak password system accessible to the world.

image from book
Seeing a Speed Difference

VNC transmits a lot of graphics and can be a bandwidth hog. If a dozen clients connect to a single server, then network traffic leaving the server can become a bottleneck and result in really slow updates for everyone.

If you need to have lots of viewers, consider farming out the load. The main server should only share the desktop with a few clients (for example, one server shares to four clients). Each of the clients also runs a server and shares with more clients. You can continue spreading the network load among computers until everyone has access. It only takes three levels of this "one server to four clients" for over 200 people to see the same thing. Although the people at the end of this chain may need to wait a second before seeing updates, this is much faster than having 200 clients access the same VNC server.

image from book

Tip 

Tunneling VNC over SSH is not always fast. For better speed performance, enable compression (-C) and change the encryption selection to use the Blowfish algorithm: ssh -C -c blowfish -L5900:localhost:5909 server.



Hacking Ubuntu
Hacking Ubuntu: Serious Hacks Mods and Customizations (ExtremeTech)
ISBN: 047010872X
EAN: 2147483647
Year: 2004
Pages: 124
Authors: Neal Krawetz

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net