07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 9.3<br />

Forwarding a remote port with SSH<br />

9.2.3. Using Remote Graphical Desktops<br />

VNC (Virtual Network Computing) allows remote access to graphical desktops.<br />

This tool is mostly used for technical assistance; the administrator can see the errors that the<br />

user is facing, and show them the correct course of action without having to stand by them.<br />

First, the user must authorize sharing their session. The GNOME and KDE graphical desktop<br />

environments include, respectively, vino and krfb, which provide a graphical interface<br />

that allows sharing an existing session over VNC (found, respectively, in the menus at System<br />

→ Preferences → Remote Desktop and K → Internet → Desktop Sharing). For other graphical<br />

desktop environments, the x11vnc command (from the Debian package of the same name)<br />

serves the same purpose; you can make it available to the user with an explicit icon.<br />

When the graphical session is made available by VNC, the administrator must connect to it with<br />

a VNC client. GNOME has vinagre and tsclient for that, while KDE includes krdc (in the menu<br />

at K → Internet → Remote Desktop Client). There are other VNC clients that use the command<br />

line, such as xvnc4viewer in the Debian package of the same name. Once connected, the administrator<br />

can see what's going on, work on the machine remotely, and show the user how to<br />

proceed.<br />

SECURITY<br />

VNC over SSH<br />

If you want to connect by VNC, and you don't want your data sent in clear<br />

text on the network, it is possible to encapsulate the data in an SSH tunnel<br />

(see Section 9.2.2.3, “Creating Encrypted Tunnels with Port Forwarding” (page<br />

192)). You simply have to know that VNC uses port 5900 by default for the<br />

first screen (called “localhost:0”), 5901 for the second (called “localhost:1”), etc.<br />

The ssh -L localhost:5901:localhost:5900 -N -T machine command creates<br />

a tunnel between local port 5901 in the localhost interface and port 5900<br />

of the machine host. The first “localhost” restricts SSH to listening to only that<br />

interface on the local machine. The second “localhost” indicates the interface<br />

on the remote machine which will receive the network traffic entering in “localhost:5901”.<br />

Thus vncviewer localhost:1 will connect the VNC client to<br />

the remote screen, even though you indicate the name of the local machine.<br />

194 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!