X11vnc
From TheLinuxVault
x11vnc is a VNC server that shares your physical X session. The following instructions are designed for Ubuntu and its sister projects, but will also work for other GNU/Linux distributions with minor changes (such as using su rather than sudo).
This x11vnc how-to was originally written by ErikTheRed and can be found at: http://ubuntuforums.org/showthread.php?t=363236
The original version of the how-to used xinetd, but other inetd daemons can also be used.
Contents |
[edit] Using with KDM
These additional steps are needed if and only if you use the KDM software to log in. Kubuntu uses KDM by default.
Add the following to /etc/kde3/kdm/kdmrc under [X-:*-Core]
AuthFile=/root/xauth
On non-Ubuntu distributions, the kdmrc file may be located in a different folder.
You can change the AuthFile to be something different, just make sure you have the same file in your server_args in your inetd services file.
Now, restart your computer (or Ctrl+Alt+Backspace to kill X) before continuing on to the next step.
[edit] Using with GDM
To use x11vnc with the GDM logon manager (used by Ubuntu/Xubuntu/Edubuntu/Linux Mint but NOT by Kubuntu), add the following to /etc/gdm/gdm.conf-custom under the [daemon] section:
KillInitClients=false
(On other distributions, this file may be located in a different folder.)
Now, restart your computer (or Ctrl+Alt+Backspace to kill X) before continuing on to the next step.
[edit] Setup
[edit] Ubuntu/Linux Mint and related projects
x11vnc is very similar to vnc, except that it allows you to view display :0, the display that would currently be showing on your monitor if you were sitting at your computer.
HINT: Replace "sudo nano" with "gksu gedit" on GNOME or "kdesu kate" on KDE for a graphical editor.
1. Install the packages
sudo aptitude install x11vnc openbsd-inetd tcpd
2. Run the following command
ps wwaux | grep auth
This command should output something like this:
root 3838 10.1 1.7 13308 8840 tty7 Ss+ 15:35 2:14 /usr/bin/X -br -nolisten tcp :0 vt7 -auth /root/xauth erik 5156 0.0 0.1 2800 752 pts/0 R+ 15:57 0:00 grep auth
Note the bolded path after -auth, as you will need this for the next step
3. Add the x11vnc service to inetd:
sudo nano /etc/inetd.conf
Add this line:
5900 stream tcp nowait root /usr/sbin/tcpd /usr/local/bin/x11vnc.sh
4. Then edit /usr/local/bin/x11vnc.sh:
sudo nano /usr/local/bin/x11vnc.sh
Enter this into the new file:
#!/bin/sh /usr/bin/x11vnc -inetd -o /var/log/x11vnc.log -display :0 \ -auth /root/xauth -many -bg
Notice the bolded path, this is where you put the path you found in step 2.
Now, to make the script executable, you have to run the command:
sudo chmod +x /usr/local/bin/x11vnc.sh
5. Restart inetd
sudo /etc/init.d/openbsd-inetd restart
6. You can now connect to display :0 from another machine by using a VNC client. For example:
vncviewer vnchost:0
[edit] Using pre-0.9 versions of x11vnc with TightVNC Viewer
If you find problems when using TightVNC Viewer with x11vnc, add the -rfbversion 3.7 option to the x11vnc arguments.
If you are using xinetd, the server_args line will look like:
server_args = -inetd -o /var/log/x11vnc.log -display :0 -auth /var/run/xauth/A:0-LliKdB -many -bg -rfbversion 3.7
IMPORTANT: Replace the -auth part with your own from step 2.

