---SERVER SETUP--- For the VNC server we will be using X11VNC simply because it is the easiest to setup for forwarding an existing X session.
NOTE: Make sure you are logged as the person who will be needing assistance.
To install open a terminal (Applications -> Accessories -> Terminal) and copy+paste/type:
sudo apt-get install -y x11vnc vnc4server
mkdir -p ~/.vnc
vncpasswd ~/.vnc/passwd
This will prompt you for a password and then store an encrypted form of it in ~/.vnc/passwd (if you want to see the encrypted form: cat ~/.vnc/passwd).
We have installed the VNC server and ran the basic setup. The next step is to create a launcher for X11VNC that will: 1) Stop any currently running sessions. 2) Tell you what port X11VNC is running on, 3) Tell you what the Public IP Address of that computer is.
To do this, in the terminal type (Actually, read on past this group of commands and come back so that you know what this does):
mkdir ~/.tech
cd ~/.tech
cat > vnc-launcher << _EOF
With the first command creating a folder that is hidden (hence the . before the word tech). The second command moves into the hidden tech directory. But the third command is a bit harder to explain. Cat is a utility to view plaintext documents. But with advanced re-direction, we can turn it into something that will take what ever you type/paste and save it in the file. Paste the following bit of code into the terminal (it should give you a > as a prompt). Then press the enter key once (to give us a new line), and then type '_EOF' without the quotes.
#!/bin/bash
## A help script to start X11 for remote assistance.
## Copyright (C) 2010 Cipherboy_LOC (of the Ubuntu Forums).
## Licensed under the GNU General Public License version 3.
## Kill all other instances of the X11VNC server to ensure that you will always get port 5900.
pkill x11vnc
## Start the server and print out the display that the server is on...
x11vnc -nap -bg -many -rfbauth ~/.vnc/passwd -desktop "VNC ${USER}@${HOSTNAME}" -ncache 2>&1 | grep -i 'PORT='
## Tell the user to give the Public IP Address to the person who will be helping them.
echo -e 'Please give this number to the tech guy:'
## Print out the number:
curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"
## Pause before exiting.
sleep 50
chmod 754 ~/.tech/ -R
chmod +x ~/.tech/vnc-launch
cat > ~/Desktop/vnclauncher.desktop << _EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Tech Support
Comment=Allow your Tech Support guy to remotely help you.
TryExec=gnome-terminal
Exec=gnome-terminal -e "bash /home/*/.tech/vnc-launch"
Icon=utilities-terminal
Type=Application
OnlyShowIn=GNOME;
PORT=5900 Please give this number to the tech guy: xxx.xxx.xxx.xxx The only thing that is left for you to do is forward the 5900 port from the router, but that is not something that I can walk you through (due to the differences in routers).
---CLIENT SETUP---
The client setup is simple now that the server is set up. You need to install a VNC viewer:
sudo apt-get install vinagre -y
---HOWTO CONNECT THE TWO COMPUTERS--- When the person with the VNC server needs help, get them to click on the desktop icon and tell you the "magic number" (their Public IP Address). Start vinagre (Applications -> Internet -> Remote Desktop Viewer), and click the connect button. In the box that comes up, it should look something like the following, except with their PublIc IP Address instead of 'X's:
[ATTACH]179378[/ATTACH]
If you have any questions, please post them here or in another thread, Cipherboy