Permalink
Switch branches/tags
Nothing to show
Find file Copy path
6642fdc Nov 3, 2018
3 contributors

Users who have contributed to this file

@bk138 @znz @The-42
18301 lines (14947 sloc) 920 KB
[![Build Status](https://travis-ci.org/LibVNC/x11vnc.svg?branch=master)](https://travis-ci.org/LibVNC/x11vnc)
This is x11vnc with its development continued by LibVNC and the GitHub community.
While 0.9.13 was the last release by the original author Karl Runge, 0.9.14 was
the first community-based release here on GitHub.
This repo represents the x11vnc codebase that once resided in the LibVNCServer repo.
It was split off LibVNCServer and moved here with
https://github.com/LibVNC/libvncserver/commit/498d222976975f53dea885cfe43ef0f805abd412.
Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com>
All rights reserved.
x11vnc README file Date: Mon Dec 27 20:58:57 EST 2010
The following information is taken from these URLs:
http://www.karlrunge.com/x11vnc/index.html
http://www.karlrunge.com/x11vnc/x11vnc_opts.html
...
they contain the most up to date info.
http://www.karlrunge.com/x11vnc/index.html:
# x11vnc: a VNC server for real X displays
x11vnc allows one to view remotely and interact with real X displays
(i.e. a display corresponding to a physical monitor, keyboard, and
mouse) with any VNC viewer. In this way it plays the role for Unix/X11
that WinVNC plays for Windows.
It has built-in SSL/TLS encryption and 2048 bit RSA authentication,
including VeNCrypt support; UNIX account and password login support;
server-side scaling; single port HTTPS/HTTP+VNC; Zeroconf service
advertising; and TightVNC and UltraVNC file-transfer. It has also been
extended to work with non-X devices: natively on Mac OS X Aqua/Quartz,
webcams and TV tuner capture devices, and embedded Linux systems such
as Qtopia Core. Full IPv6 support is provided. More features are
described here.
It also provides an encrypted Terminal Services mode (-create, -svc,
or -xdmsvc options) based on Unix usernames and Unix passwords where
the user does not need to memorize his VNC display/port number.
Normally a virtual X session (Xvfb) is created for each user, but it
also works with X sessions on physical hardware. See the tsvnc
terminal services mode of the SSVNC viewer for one way to take
advantage of this mode.
I wrote x11vnc back in 2002 because x0rfbserver was basically
impossible to build on Solaris and had poor performance. The primary
x0rfbserver build problems centered around esoteric C++ toolkits.
x11vnc is written in plain C and needs only standard libraries and so
should work on nearly all Unixes, even very old ones. I also created
enhancements to improve the interactive response, added many features,
and etc.
This page including the FAQ contains much information [*]; solutions
to many problems; and interesting applications, but nevertheless
please feel free to contact me if you have problems or questions (and
if I save you time or expense by giving you some of my time, please
consider a PayPal Donation.) Do check the FAQ and this page first; I
realize the pages are massive, but you can often use your browser's
find-in-page search action using a keyword to find the answer to your
problem or question.
SSVNC: An x11vnc side-project provides an Enhanced TightVNC Viewer
package (SSVNC) for Unix, Windows, and Mac OS X with automatic SSL
and/or SSH tunnelling support, SSL Certificate creation, Saved
connection profiles, Zeroconf, VeNCrypt, and built-in Proxy support.
Added features for the TightVNC Unix viewer: NewFBSize, ZRLE encoding,
Viewer-side Scaling, cursor alphablending, low color modes, and
enhanced popup menu; UltraVNC extensions support for: File Transfer,
Text Chat, Single Window, Server Input, and 1/n Scaling extensions,
and UltraVNC DSM encryption. The SSVNC bundle could be placed on, say,
a USB memory stick for SSL/SSH VNC viewing from nearly any networked
computer.
# Announcements:
Important: If you created any permanent SSL certificates (e.g. via
"x11vnc -ssl SAVE ...") on a Debian or Ubuntu system from Sept. 2006
through May 2008, then those keys are likely extremely weak and can be
easily cracked. The certificate files should be deleted and recreated
on a non-Debian system or an updated one. See
http://www.debian.org/security/2008/dsa-1571 for details. The same
applies to SSH keys (not used by x11vnc directly, but many people use
SSH tunnels for VNC access.)
FAQ moved: The huge FAQ has finally been moved to its own page. If you
are trying to follow someone's link to an FAQ once on this page it is
now a broken link. Try inserting the string "faq.html", e.g.:
from: http://www.karlrunge.com/x11vnc/#faq-singleclick
to: http://www.karlrunge.com/x11vnc/faq.html#faq-singleclick
Apologies for the inconvenience, unfortunately it is not possible to
automatically redirect to the new page since the '#' anchor is not
sent to the webserver.
# Background:
VNC (Virtual Network Computing) is a very useful network graphics
protocol (applications running on one computer but displaying their
windows on another) in the spirit of X, however, unlike X, the
viewing-end is very simple and maintains no state. It is a remote
framebuffer (RFB) protocol.
Some VNC links:
* http://www.realvnc.com
* http://www.tightvnc.com
* http://www.ultravnc.com/
* http://www.testplant.com/products/vine_server/OS_X
For Unix, the traditional VNC implementation includes a "virtual" X11
server Xvnc (usually launched via the vncserver command) that is not
associated with a physical display, but provides a "fake" one X11
clients (xterm, firefox, etc.) can attach to. A remote user then
connects to Xvnc via the VNC client vncviewer from anywhere on the
network to view and interact with the whole virtual X11 desktop.
The VNC protocol is in most cases better suited for remote connections
with low bandwidth and high latency than is the X11 protocol because
it involves far fewer "roundtrips" (an exception is the cached pixmap
data on the viewing-end provided by X.) Also, with no state maintained
the viewing-end can crash, be rebooted, or relocated and the
applications and desktop continue running. Not so with X11.
So the standard Xvnc/vncserver program is very useful, I use it for
things like:
* Desktop conferencing with other users (e.g. code reviews.)
* Long running apps/tasks I want to be able to view from many places
(e.g. from home and work.)
* Motif, GNOME, and similar applications that would yield very poor
performance over a high latency link.
However, sometimes one wants to connect to a real X11 display (i.e.
one attached to a physical monitor, keyboard, and mouse: a Workstation
or a SunRay session) from far away. Maybe you want to close down an
application cleanly rather than using kill, or want to work a bit in
an already running application, or would like to help a distant
colleague solve a problem with their desktop, or would just like to
work out on the deck for a while. This is where x11vnc is useful.
# How to use x11vnc:
In this basic example let's assume the remote machine with the X
display you wish to view is "far-away.east:0" and the workstation you
are presently working at is "sitting-here.west".
Step 0. Download x11vnc (see below) and have it available to run on
far-away.east (on some linux distros it is as easy as "apt-get install
x11vnc", "emerge x11vnc", etc.) Similarly, have a VNC viewer (e.g.
vncviewer) ready to run on sitting-here.west. We recommend TightVNC
Viewers (see also our SSVNC viewer.)
Step 1. By some means log in to far-away.east and get a command shell
running there. You can use ssh, or even rlogin, telnet, or any other
method to do this. We do this because the x11vnc process needs to be
run on the same machine the X server process is running on (otherwise
things would be extremely slow.)
Step 2. In that far-away.east shell (with command prompt "far-away>"
in this example) run x11vnc directed at the far-away.east X session
display:
```
far-away> x11vnc -display :0
```
You could have also set the environment variable DISPLAY=:0 instead of
using "-display :0". This step attaches x11vnc to the far-away.east:0
X display (i.e. no viewer clients yet.)
Common Gotcha: To get X11 permissions right, you may also need to set
the XAUTHORITY environment variable (or use the -auth option) to point
to the correct MIT-MAGIC-COOKIE file (e.g. /home/joe/.Xauthority.) If
x11vnc does not have the authority to connect to the display it exits
immediately. More on how to fix this below.
If you suspect an X11 permissions problem do this simple test: while
sitting at the physical X display open a terminal window
(gnome-terminal, xterm, etc.) You should be able to run x11vnc
successfully in that terminal without any need for command line
options. If that works OK then you know X11 permissions are the only
thing preventing it from working when you try to start x11vnc via a
remote shell. Then fix this with the tips below.
Note as of Feb/2007 you can also try the -find option instead of
"-display ..." and see if that finds your display and Xauthority. Note
as of Dec/2009 the -findauth and "-auth guess" options may be helpful
as well.
(End of Common Gotcha)
When x11vnc starts up there will then be much chatter printed out (use
"-q" to quiet it), until it finally says something like:
```
.
.
13/05/2004 14:59:54 Autoprobing selected port 5900
13/05/2004 14:59:54 screen setup finished.
13/05/2004 14:59:54
13/05/2004 14:59:54 The VNC desktop is far-away:0
PORT=5900
```
which means all is OK, and we are ready for the final step.
Step 3. At the place where you are sitting (sitting-here.west in this
example) you now want to run a VNC viewer program. There are VNC
viewers for Unix, Windows, MacOS, Java-enabled web browsers, and even
for PDA's like the Palm Pilot and Cell Phones! You can use any of them
to connect to x11vnc (see the above VNC links under "Background:" on
how to obtain a viewer for your platform or see this FAQ. For Solaris,
vncviewer is available in the Companion CD package SFWvnc.)
In this example we'll use the Unix vncviewer program on sitting-here
by typing the following command in a second terminal window:
```
sitting-here> vncviewer far-away.east:0
```
That should pop up a viewer window on sitting-here.west showing and
allowing interaction with the far-away.east:0 X11 desktop. Pretty
nifty! When finished, exit the viewer: the remote x11vnc process will
shutdown automatically (or you can use the -forever option to have it
wait for additional viewer connections.)
Common Gotcha: Nowadays there will likely be a host-level firewall on
the x11vnc side that is blocking remote access to the VNC port (e.g.
5900.) You will either have to open up that port (or a range of ports)
in your firewall administration tool, or try the SSH tunnelling method
below (even still the firewall must allow in the SSH port, 22.)
Shortcut: Of course if you left x11vnc running on far-away.east:0 in a
terminal window with the -forever option or as a service, you'd only
have to do Step 3 as you moved around. Be sure to use a VNC Password
or other measures if you do that.
Super Shortcut: Here is a potentially very easy way to get all of it
working.
* Have x11vnc (0.9.3 or later) available to run on the remote host
(i.e. in $PATH.)
* Download and unpack a SSVNC bundle (1.0.19 or later, e.g.
ssvnc_no_windows-1.0.28.tar.gz) on the Viewer-side machine.
* Start the SSVNC Terminal Services mode GUI: ./ssvnc/bin/tsvnc
* Enter your remote username@hostname (e.g. fred@far-away.east) in
the "VNC Terminal Server" entry.
* Click "Connect".
That will do an SSH to username@hostname and start up x11vnc and then
connect a VNC Viewer through the SSH encrypted tunnel.
There are a number of things assumed here, first that you are able to
SSH into the remote host; i.e. that you have a Unix account there and
the SSH server is running. On Unix and MacOS X it is assumed that the
ssh client command is available on the local machine (on Windows a
plink binary is included in the SSVNC bundle.) Finally, it is assumed
that you are already logged into an X session on the remote machine,
e.g. your workstation (otherwise, a virtual X server, e.g. Xvfb, will
be started for you.)
In some cases the remote SSH server will not run commands with the
same $PATH that you normally have in your shell there. In this case
click on Options -> Advanced -> X11VNC Options, and type in the
location of the x11vnc binary under "Full Path". (End of Super
Shortcut)
Desktop Sharing: The above more or less assumed nobody was sitting at
the workstation display "far-away.east:0". This is often the case: a
user wants to access her workstation remotely. Another usage pattern
has the user sitting at "far-away.east:0" and invites one or more
other people to view and interact with his desktop. Perhaps the user
gives a demo or presentation this way (using the telephone for vocal
communication.) A "Remote Help Desk" mode would be similar: a
technician connects remotely to the user's desktop to interactively
solve a problem the user is having.
For these cases it should be obvious how it is done. The above steps
will work, but more easily the user sitting at far-away.east:0 simply
starts up x11vnc from a terminal window, after which the guests would
start their VNC viewers. For this usage mode the "-connect
host1,host2" option may be of use to automatically connect to the
vncviewers in "-listen" mode on the list of hosts.
# Tunnelling x11vnc via SSH:
The above example had no security or privacy at all. When logging into
remote machines (certainly when going over the internet) it is best to
use ssh, or use a VPN (for a VPN, Virtual Private Network, the above
example should be pretty safe.)
For x11vnc one can tunnel the VNC protocol through an encrypted ssh
channel. It would look something like running the following commands:
```
sitting-here> ssh -t -L 5900:localhost:5900 far-away.east 'x11vnc -localhost
-display :0'
```
(you will likely have to provide passwords/passphrases to login from
sitting-here into your far-away.east Unix account; we assume you have
a login account on far-away.east and it is running the SSH server)
And then in another terminal window on sitting-here run the command:
```
sitting-here> vncviewer -encodings "copyrect tight zrle hextile" localhost:0
```
Note: The -encodings option is very important: vncviewer will often
default to "raw" encoding if it thinks the connection is to the local
machine, and so vncviewer gets tricked this way by the ssh
redirection. "raw" encoding will be extremely slow over a networked
link, so you need to force the issue with -encodings "copyrect tight
...". Nowadays, not all viewers use the -encodings option, try
"-PreferredEncoding=ZRLE" (although the newer viewers seem to
autodetect well when to use raw or not.)
Note that "x11vnc -localhost ..." limits incoming vncviewer
connections to only those from the same machine. This is very natural
for ssh tunnelling (the redirection appears to come from the same
machine.) Use of a VNC password is also strongly recommended.
Note also the -t we used above (force allocate pseudoterminal), it
actually seems to improve interactive typing response via VNC!
You may want to add the -C option to ssh to enable compression. The
VNC compression is not perfect, and so this may help a bit. However,
over a fast LAN you probably don't want to enable SSH compression
because it can slow things down. Try both and see which is faster.
If your username is different on the remote machine use something
like: "fred@far-away.east" in the above ssh command line.
Some VNC viewers will do the ssh tunnelling for you automatically, the
TightVNC Unix vncviewer does this when the "-via far-away.east" option
is supplied to it (this requires x11vnc to be already running on
far-away.east or having it started by inetd(8).) See the 3rd script
example below for more info.
SSVNC: You may also want to look at the Enhanced TightVNC Viewer
(ssvnc) bundles because they contain scripts and GUIs to automatically
set up SSH tunnels (e.g. the GUI, "ssvnc", does it automatically and
so does this command: "ssvnc_cmd -ssh user@far-away.east:0") and can
even start up x11vnc as well.
The Terminal Services mode of SSVNC is perhaps the easiest way to use
x11vnc. You just need to have x11vnc available in $PATH on the remote
side (and can SSH to the host), and then on the viewer-side you type
something like:
```
tsvnc fred@far-away.east
```
everything else is done automatically for you. Normally this will
start a virtual Terminal Services X session (RAM-only), but if you
already have a real X session up on the physical hardware it will find
that one for you.
Gateways: If the machine you SSH into is not the same machine with
the X display you wish to view (e.g. your company provides incoming
SSH access to a gateway machine), then you need to change the above
to, e.g.: "-L 5900:OtherHost:5900":
```
sitting-here> ssh -t -L 5900:OtherHost:5900 gateway.east
```
Where gateway.east is the internet hostname (or IP) of the gateway
machine (SSH server.) 'OtherHost' might be, e.g., freds-pc or
192.168.2.33 (it is OK for these to be private hostnames or private IP
addresses, the host in -L is relative to the remote server side.)
Once logged in, you'll need to do a second login (ssh, rsh, etc.) to
the workstation machine 'OtherHost' and then start up x11vnc on it (if
it isn't already running.) (The "-connect gateway:59xx" option may be
another alternative here with the viewer already in -listen mode.) For
an automatic way to use a gateway and have all the network traffic
encrypted (including inside the firewall) see Chaining SSH's.
These gateway access modes also can be done automatically for you via
the "Proxy/Gateway" setting in SSVNC (including the Chaining SSH's
case, "Double Proxy".)
Firewalls/Routers:
A lot of people have inexpensive devices for home or office that act
as a Firewall and Router to the machines inside on a private LAN. One
can usually configure the Firewall/Router from inside the LAN via a
web browser.
Often having a Firewall/Router sitting between the vncviewer and
x11vnc will make it impossible for the viewer to connect to x11vnc.
One thing that can be done is to redirect a port on the
Firewall/Router to, say, the SSH port (22) on an inside machine (how
to do this depends on your particular Firewall/Router, often the
router config URL is http://192.168.100.1 See www.portforward.com for
more info.) This way you reach these computers from anywhere on the
Internet and use x11vnc to view X sessions running on them.
Suppose you configured the Firewall/Router to redirect these ports to
two internal machines:
```
Port 12300 -> 192.168.1.3, Port 22 (SSH)
Port 12301 -> 192.168.1.4, Port 22 (SSH)
(where 192.168.1.3 is "jills-pc" and 192.168.1.4 is "freds-pc".) Then
the ssh's would look something like:
sitting-here> ssh -t -p 12300 -L 5900:localhost:5900 jill@far-away.east 'x11v
nc -localhost -display :0'
sitting-here> ssh -t -p 12301 -L 5900:localhost:5900 fred@far-away.east 'x11v
nc -localhost -display :0'
```
Where far-away.east means the hostname (or IP) that the
Router/Firewall is using (for home setups this is usually the IP
gotten from your ISP via DHCP, the site http://www.whatismyip.com/ is
a convenient way to determine what it is.)
It is a good idea to add some obscurity to accessing your system via
SSH by using some high random port (e.g. 12300 in the above example.)
If you can't remember it, or are otherwise not worried about port
scanners detecting the presence of your SSH server and there is just
one internal PC involved you could map 22:
```
Port 22 -> 192.168.1.3, Port 22 (SSH)
```
Again, this SSH gateway access can be done automatically for you via
the "Proxy/Gateway" setting in SSVNC. And under the "Remote SSH
Command" setting you can enter the x11vnc -localhost -display :0.
Host-Level-Firewalls: even with the hardware Firewall/Router problem
solved via a port redirection, most PC systems have their own Host
level "firewalls" enabled to protect users from themselves. I.e. the
system itself blocks all incoming connections. So you will need to see
what is needed to configure it to allow in the port (e.g. 22) that you
desire. E.g. Yast, Firestarter, iptables(1), etc..
VNC Ports and Firewalls: The above discussion was for configuring the
Firewall/Router to let in port 22 (SSH), but the same thing can be
done for the default VNC port 5900:
```
Port 5900 -> 192.168.1.3, Port 5900 (VNC)
Port 5901 -> 192.168.1.4, Port 5900 (VNC)
```
(where 192.168.1.3 is "jills-pc" and 192.168.1.4 is "freds-pc".) This
could be used for normal, unencrypted connections and also for SSL
encrypted ones.
The VNC displays to enter in the VNC viewer would be, say,
"far-away.east:0" to reach jills-pc and "far-away.east:1" to reach
freds-pc. We assume above that x11vnc is using port 5900 (and any
Host-Level-firewalls on jills-pc has been configured to let that port
in.) Use the "-rfbport" option to tell which port x11vnc should listen
on.
For a home system one likely does not have a hostname and would have
to use the IP address, say, "24.56.78.93:0". E.g.:
```
vncviewer 24.56.78.93:0
```
You may want to choose a more obscure port on the router side, e.g.
5944, to avoid a lot of port scans finding your VNC server. For 5944
you would tell the viewer to use:
```
vncviewer 24.56.78.93:44
```
The IP address would need to be communicated to the person running the
VNC Viewer. The site http://www.whatismyip.com/ can help here.
Scripts to automate ssh tunneling: As discussed below, there may be
some problems with port 5900 being available. If that happens, the
above port and display numbers may change a bit (e.g. -> 5901 and :1).
However, if you "know" port 5900 will be free on the local and remote
machines, you can easily automate the above two steps by using the
x11vnc option -bg (forks into background after connection to the
display is set up) or using the -f option of ssh. Some example scripts
are shown below. Feel free to try the ssh -C to enable its compression
and see if that speeds things up noticeably.
#1. A simple example script, assuming no problems with port 5900 being
taken on the local or remote sides, looks like:
```
#!/bin/sh
# usage: x11vnc_ssh <host>:<xdisplay>
# e.g.: x11vnc_ssh snoopy.peanuts.com:0
# (user@host:N also works)
host=`echo $1 | awk -F: '{print $1}'`
disp=`echo $1 | awk -F: '{print $2}'`
if [ "x$disp" = "x" ]; then disp=0; fi
cmd="x11vnc -display :$disp -localhost -rfbauth .vnc/passwd"
enc="copyrect tight zrle hextile zlib corre rre raw"
ssh -f -t -L 5900:localhost:5900 $host "$cmd"
for i in 1 2 3
do
sleep 2
if vncviewer -encodings "$enc" :0; then break; fi
done
```
See also rx11vnc.pl below.
#2. Another method is to start the VNC viewer in listen mode
"vncviewer -listen" and have x11vnc initiate a reverse connection
using the -connect option:
```
#!/bin/sh
# usage: x11vnc_ssh <host>:<xdisplay>
# e.g.: x11vnc_ssh snoopy.peanuts.com:0
# (user@host:N also works)
host=`echo $1 | awk -F: '{print $1}'`
disp=`echo $1 | awk -F: '{print $2}'`
if [ "x$disp" = "x" ]; then disp=0; fi
cmd="x11vnc -display :$disp -localhost -connect localhost" # <== note new opt
ion
enc="copyrect tight zrle hextile zlib corre rre raw"
vncviewer -encodings "$enc" -listen &
pid=$!
ssh -t -R 5500:localhost:5500 $host "$cmd"
kill $pid
```
Note the use of the ssh option "-R" instead of "-L" to set up a remote
port redirection.
#3. A third way is specific to the TightVNC vncviewer special option
-via for gateways. The only tricky part is we need to start up x11vnc
and give it some time (5 seconds in this example) to start listening
for connections (so we cannot use the TightVNC default setting for
VNC_VIA_CMD):
```
#!/bin/sh
# usage: x11vnc_ssh <host>:<xdisplay>
# e.g.: x11vnc_ssh snoopy.peanuts.com:0
host=`echo $1 | awk -F: '{print $1}'`
disp=`echo $1 | awk -F: '{print $2}'`
if [ "x$disp" = "x" ]; then disp=0; fi
VNC_VIA_CMD="ssh -f -t -L %L:%H:%R %G x11vnc -localhost -rfbport 5900 -display
:$disp; sleep 5"
export VNC_VIA_CMD
vncviewer -via $host localhost:0 # must be TightVNC vncviewer.
```
Of course if you already have the x11vnc running waiting for
connections (or have it started out of inetd(8)), you can simply use
the TightVNC "vncviewer -via gateway host:port" in its default mode to
provide secure ssh tunnelling.
VNC password file: Also note in the #1. example script that the option
"-rfbauth .vnc/passwd" provides additional protection by requiring a
VNC password for every VNC viewer that connects. The vncpasswd or
storepasswd programs, or the x11vnc -storepasswd option can be used to
create the password file. x11vnc also has the slightly less secure
-passwdfile and "-passwd XXXXX" options to specify passwords.
Very Important: It is up to YOU to tell x11vnc to use password
protection (-rfbauth or -passwdfile), it will NOT do it for you
automatically or force you to (use -usepw if you want to be forced
to.) The same goes for encrypting the channel between the viewer and
x11vnc: it is up to you to use ssh, stunnel, -ssl mode, a VPN, etc.
(use the Enhanced TightVNC Viewer (SSVNC) GUI if you want to be forced
to use SSL or SSH.) For additional safety, also look into the -allow
and -localhost options and building x11vnc with tcp_wrappers support
to limit host access.
# Tunnelling x11vnc via SSL/TLS:
One can also encrypt the VNC traffic using an SSL/TLS tunnel such as
stunnel.mirt.net (also stunnel.org) or using the built-in (Mar/2006)
-ssl openssl mode. A SSL-enabled Java applet VNC Viewer is also
provided in the x11vnc package (and https can be used to download it.)
Although not as ubiquitous as ssh, SSL tunnelling still provides a
useful alternative. See this FAQ on -ssl and -stunnel modes for
details and examples.
The Enhanced TightVNC Viewer (SSVNC) bundles contain some convenient
utilities to automatically set up an SSL tunnel from the viewer-side
(i.e. to connect to "x11vnc -ssl ...".) And many other enhancements
too.
# Downloading x11vnc:
x11vnc is a contributed program to the LibVNCServer project at
SourceForge.net. I use libvncserver for all of the VNC aspects; I
couldn't have done without it. The full source code may be found and
downloaded (either file-release tarball or GIT tree) from the above
link. As of Sep 2010, the x11vnc-0.9.12.tar.gz source package is
released (recommended download). The x11vnc 0.9.12 release notes.
The x11vnc package is the subset of the libvncserver package needed to
build the x11vnc program. Also, you can get a copy of my latest,
bleeding edge x11vnc-0.9.13-dev.tar.gz tarball to build the most up to
date one.
Precompiled Binaries/Packages: See the FAQ below for information
about where you might obtain a precompiled x11vnc binary from 3rd
parties and some ones I create.
VNC Viewers: To obtain VNC viewers for the viewing side (Windows, Mac
OS, or Unix) try these links:
* http://www.tightvnc.com/download.html
* http://www.realvnc.com/download-free.html
* http://sourceforge.net/projects/cotvnc/
* http://www.ultravnc.com/
* Our Enhanced TightVNC Viewer (SSVNC)
[ssvnc.gif]
More tools: Here is a ssh/rsh wrapper script rx11vnc that attempts to
automatically do the above Steps 1-3 for you (provided you have
ssh/rsh login permission on the machine x11vnc is to be run on.) The
above example would be: "rx11vnc far-away.east:0" typed into a shell
on sitting-here.west. Also included is an experimental script
rx11vnc.pl that attempts to tunnel the vnc traffic through an ssh port
redirection (and does not assume port 5900 is free.) Have a look at
them to see what they do and customize as needed:
* rx11vnc wrapper script
* rx11vnc.pl wrapper script to tunnel traffic thru ssh
# Building x11vnc:
Make sure you have all the needed build/compile/development packages
installed. On a Debian-based distro you can simply do
```
sudo apt-get build-dep x11vnc
```
to install most of them.
To generate the build system, do a
```
autoreconf -fiv
```
After that, it's the usual
```
./configure
make
```
You might want to take a look at the dfferent configure options
provided by `configure --help` to build without X11 or adapt the
build to your needs in other ways.
Building on Solaris, FreeBSD, etc: Depending on your version of
Solaris or other Unix OS the jpeg and/or zlib libraries may be in
non-standard places (e.g. /usr/local, /usr/sfw, /opt/sfw, etc.)
Note: If configure cannot find these two libraries then TightVNC and
ZRLE encoding support will be disabled, and you don't want that!!! The
TightVNC encoding gives very good compression and performance, it even
makes a noticeable difference over a fast LAN.
Shortcuts: On Solaris 10 you can pick up almost everything just by
insuring that your PATH has /usr/sfw/bin (for gcc) and /usr/ccs/bin
(for other build tools), e.g.:
```
env PATH=/usr/sfw/bin:/usr/ccs/bin:$PATH sh -c './configure; make'
```
(The only thing this misses is /usr/X11/lib/libXrandr.so.2, which is
for the little used -xrandr option, see the script below to pick it up
as well.)
libjpeg is included in Solaris 9 and later (/usr/sfw/include and
/usr/sfw/lib), and zlib in Solaris 8 and later (/usr/include and
/usr/lib.) So on Solaris 9 you can pick up everything with something
like this:
```
env PATH=/usr/local/bin:/usr/ccs/bin:$PATH sh -c './configure --with-jpeg=/us
r/sfw; make'
```
assuming your gcc is in /usr/local/bin and x11vnc 0.7.1 or later.
These are getting pretty long, see those assignments split up in the
build script below.
If your system does not have these libraries at all you can get the
source for the libraries to build them: libjpeg is available at
ftp://ftp.uu.net/graphics/jpeg/ and zlib at http://www.gzip.org/zlib/.
See also http://www.sunfreeware.com/ for Solaris binary packages of
these libraries as well as for gcc. Normally they will install into
/usr/local but you can install them anywhere with the
--prefix=/path/to/anywhere, etc.
Here is a build script that indicates one way to pass the library
locations information to the libvncserver configuration via the
CPPFLAGS and LDFLAGS environment variables.
```
#!/bin/sh
# Build script for Solaris, etc, with gcc, libjpeg and libz in
# non-standard locations.
# set to get your gcc, etc:
#
PATH=/path/to/gcc/bin:/usr/ccs/bin:/usr/sfw/bin:$PATH
JPEG=/path/to/jpeg # set to maybe "/usr/local", "/usr/sfw", or "/opt/sfw"
ZLIB=/path/to/zlib # set to maybe "/usr/local", "/usr/sfw", or "/opt/sfw"
# Below we assume headers in $JPEG/include and $ZLIB/include and the
# shared libraries are in $JPEG/lib and $ZLIB/lib. If your situation
# is different change the locations in the two lines below.
#
CPPFLAGS="-I $JPEG/include -I $ZLIB/include"
LDFLAGS="-L$JPEG/lib -R $JPEG/lib -L$ZLIB/lib -R $ZLIB/lib"
# These two lines may not be needed on more recent Solaris releases:
#
CPPFLAGS="$CPPFLAGS -I /usr/openwin/include"
LDFLAGS="$LDFLAGS -L/usr/openwin/lib -R /usr/openwin/lib"
# These are for libXrandr.so on Solaris 10:
#
CPPFLAGS="$CPPFLAGS -I /usr/X11/include"
LDFLAGS="$LDFLAGS -L/usr/X11/lib -R /usr/X11/lib"
# Everything needs to built with _REENTRANT for thread safe errno:
#
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
export PATH CPPFLAGS LDFLAGS
./configure
make
ls -l ./x11vnc/x11vnc
```
Then do make install or copy the x11vnc binary to your desired
destination.
BTW, To run a shell script, just cut-and-paste the above into a file,
say "myscript", then modify the "/path/to/..." items to correspond to
your system/environment, and then type: "sh myscript" to run it.
Note that on Solaris make is /usr/ccs/bin/make, so that is why the
above puts /usr/ccs/bin in PATH. Other important build utilities are
there too: ld, ar, etc. Also, it is probably a bad idea to have
/usr/ucb in your PATH while building.
Starting with the 0.7.1 x11vnc release the "configure --with-jpeg=DIR
--with-zlib=DIR" options are handy if you want to avoid making a
script.
If you need to link OpenSSL libssl.a on Solaris see this method.
If you need to build on Solaris 2.5.1 or earlier or other older Unix
OS's, see this workaround FAQ.
Building on FreeBSD, OpenBSD, ...: The jpeg libraries seem to be in
/usr/local or /usr/pkg on these OS's. You won't need the openwin stuff
in the above script (but you may need /usr/X11R6/....) Also starting
with the 0.7.1 x11vnc release, this usually works:
```
./configure --with-jpeg=/usr/local
make
```
Building on HP-UX: For jpeg and zlib you will need to do the same
sort of thing as described above for Solaris. You set CPPFLAGS and
LDFLAGS to find them (see below for an example.) You do not need to do
any of the above /usr/openwin stuff. Also, HP-UX does not seem to
support -R, so get rid of the -R items in LDFLAGS. Because of this, at
runtime you may need to set LD_LIBRARY_PATH or SHLIB_PATH to indicate
the directory paths so the libraries can be found. It is a good idea
to have static archives, e.g. libz.a and libjpeg.a for the nonstandard
libraries so that they get bolted into the x11vnc binary (and so won't
get "lost".)
Here is what we recently did to build x11vnc 0.7.2 on HP-UX 11.11
```
./configure --with-jpeg=$HOME/hpux/jpeg --with-zlib=$HOME/hpux/zlib
make
```
Where we had static archives (libjpeg.a, libz.a) only and header files
in the $HOME/hpux/... directories as discussed for the build script.
On HP-UX 11.23 and 11.31 we have had problems compiling with gcc.
"/usr/include/rpc/auth.h:87: error: field 'syncaddr' has incomplete
type". As a workaround for x11vnc 0.9.4 and later set your CPPFLAGS to
include:
```
CPPFLAGS="-DIGNORE_GETSPNAM"
export CPPFLAGS
```
This disables a very rare usage mode for -unixpw_nis by not trying
getspnam(3).
Using HP-UX's C compiler on 11.23 and 11.31 we have some severe
compiler errors that have not been worked around yet. If you need to
do this, contact me and I will give you a drastic recipe that will
produce a working binary.
Building on AIX: AIX: one user had to add the "X11.adt" package to
AIX 4.3.3 and 5.2 to get build header files like XShm.h, etc. You may
also want to make sure that /usr/lpp/X11/include, etc is being picked
up by the configure and make.
For a recent build on AIX 5.3 we needed to add these CFLAGS to be able
to build with gcc:
env CFLAGS='-maix64 -Xlinker -bbigtoc' ./configure ...
we also built our own libjpeg and libz using -maix64.
BTW, one way to run an Xvfb-like virtual X server for testing on AIX
is something like "/usr/bin/X11/X -force -vfb -ac :1".
Building on Mac OS X: There is now native Mac OS X support for
x11vnc by using the raw framebuffer feature. This mode does not use or
need X11 at all. To build you may need to disable X11:
```
./configure --without-x ...
make
```
However, if your system has the Mac OS X build package for X11 apps
you will not need to supply the "--without-x" option (in this case the
resulting x11vnc would be able to export both the native Mac OS X
display and windows displayed in the XDarwin X server.) Be sure to
include the ./configure option to find libjpeg on your system.
OpenSSL: Starting with version 0.8.3 x11vnc can now be built with
SSL/TLS support. For this to be enabled the libssl.so library needs to
be available at build time. So you may need to have additional
CPPFLAGS and LDFLAGS items if your libssl.so is in a non-standard
place. As of x11vnc 0.9.4 there is also the --with-ssl=DIR configure
option.
Note that from OpenSSL 1.1.0 on SSLv2 support has been dropped and
SSLv3 deactivated at build time per default. This means that unless
explicitly enabled, OpenSSL builds only support TLS (any version).
Since there is a reason for dropping SSLv3 (heard of POODLE?), most
distributions do not enable it for their OpenSSL binary. In summary
this means compiling x11vnc against OpenSSL 1.1.0 or newer is no
problem, but using encryption will require a viewer with TLS support.
On Solaris using static archives libssl.a and libcrypto.a instead of
.so shared libraries (e.g. from www.sunfreeware.com), we found we
needed to also set LDFLAGS as follows to get the configure to work:
```
env LDFLAGS='-lsocket -ldl' ./configure --with-ssl=/path/to/openssl ...
make
```
# Beta Testing:
I don't have any formal beta-testers for the releases of x11vnc, so
I'd appreciate any additional testing very much.
Thanks to those who suggested features and helped beta test x11vnc
0.9.12 released in Sep 2010!
Please help test and debug the 0.9.13 version for release sometime in
Winter 2010.
The version 0.9.13 beta tarball is kept here:
x11vnc-0.9.13-dev.tar.gz
There are also some Linux, Solaris, Mac OS X, and other OS test
binaries here. Please kick the tires and report bugs, performance
regressions, undesired behavior, etc. to me.
To aid testing of the built-in SSL/TLS support for x11vnc, a number of
VNC Viewer packages for Unix, Mac OS X, and Windows have been created
that provide SSL Support for the TightVNC Viewer (this is done by
wrapper scripts and a GUI that starts STUNNEL.) It should be pretty
convenient for automatic SSL and SSH connections. It is described in
detail at and can be downloaded from the Enhanced TightVNC Viewer
(SSVNC) page. The SSVNC Unix viewer also supports x11vnc's symmetric
key encryption ciphers (see the 'UltraVNC DSM Encryption Plugin'
settings panel.)
Here are some features that will appear in the 0.9.13 release:
* Improved support for non-X11 touchscreen devices (e.g. handheld or
cell phone) via Linux uinput input injection. Additional tuning
parameters are added. TSLIB touchscreen calibration is supported.
Tested on Qtmoko Neo Freerunner. A tool, misc/uinput.pl, is
provided to diagnose uinput behavior on new devices. The env.
vars. X11VNC_UINPUT_BUS and X11VNC_UINPUT_VERSION are available if
leaving them unset does not work.
* The Linux uinput non-X11 input injection can now be bypassed:
events can be directly written to the /dev/input/event devices
specified by the user (direct_abs=..., etc.) A -pipeinput input
injection helper script, misc/qt_tslib_inject.pl is provided as a
tweakable non-builtin direct input injection method.
* The list of new uinput parameters for the above two features is:
pressure, tslib_cal, touch_always, dragskip, btn_touch;
direct_rel, direct_abs, direct_btn, direct_key.
* The MacOSX native server can now use OpenGL for the screen
capture. In nearly all cases this is faster than the raw
framebuffer capture method. There are build and run time flags,
X11VNC_MACOSX_NO_DEPRECATED, etc. to disable use of deprecated
input injection and screen access interfaces. Cursor shape now
works for 64bit binaries.
* The included SSL enabled Java VNC Viewers now handle Mouse Wheel
events.
* miscellaneous new features and changes:
* In -reflect mode, the libvncclient connection can now have the
pixel format modified via the environment variables
X11VNC_REFLECT_bitsPerSample, X11VNC_REFLECT_samplesPerPixel, and
X11VNC_REFLECT_bytesPerPixel
* In -create mode the following environment variables are added to
fine tune the behavior: FIND_DISPLAY_NO_LSOF: do not use lsof(1)
to try to determine the Linux VT, FIND_DISPLAY_NO_VT_FIND: do not
try to determine the Linux VT at all, X11VNC_CREATE_LC_ALL_C_OK:
do not bother undoing the setting LC_ALL=C that the create_display
script sets. The performance of the -create script has been
improved for large installations (100's of user sessions on one
machine.)
* In -unixpw mode, one can now Tab from login: to Password.
* An environment variable, X11VNC_SB_FACTOR, allows one to scale the
-sb screenblank sleep time from the default 2 secs.
* An experimental option -unixsock is available for testing. Note,
however, that it requires a manual change to
libvncserver/rfbserver.c for it to work.
* Documented that -grabkbd is no longer working with some/most
window managers (it can prevent resizing and menu posting.)
Here are some features that appeared in the 0.9.12 release (Sep/2010):
* One can now specify the maximum number of displays that can be
created in -create mode via the env. var.
X11VNC_CREATE_MAX_DISPLAYS
* The X11VNC_NO_LIMIT_SHM env. var. is added to skip any automatic
shared memory reduction.
* The kdm display manager is now detected when trying not to get
killed by the display manager.
* A compile time bug is fixed so that configuring using
--with-system-libvncserver pointing to LibVNCServer 0.9.7 works
again. A bug from forced use of Xdefs.h is worked around.
Here are some features that appeared in the 0.9.11 release (Aug/2010):
* The source tree is synchronized with the most recent libvncclient
(this only affects -reflect mode.) Build is fixed for
incompatibilities when using an external LibVNCServer (e.g.
./configure --with-system-libvncserver...) Please help test these
build and runtime aspects and report back what you find, thanks.
* The SSL enabled Java VNC Viewer Makefile has been modified so that
the jar files that are built are compatible back to Java 1.4.
* In -create/-unixpw mode, the env. var. FD_USERPREFS may be set to
a filename in the user's home directory that includes default
username:options values (so the options do not need to be typed
every time at the login prompt.)
* In -reflect mode cursor position updates are now handled
correctly.
Here are some features that appeared in the 0.9.10 release (May/2010):
* The included SSL enabled Java applet viewer now supports Chained
SSL Certificates. The debugCerts=yes applet parameter aids
troubleshooting certificate validation. The x11vnc -ssl mode has
always supported chained SSL certificates (simply put the
intermediate certificates, in order, after the server certificate
in the pem file.)
* A demo CGI script desktop.cgi shows how to create an SSL
encrypted, multi-user x11vnc web login desktop service. The script
requires x11vnc version 0.9.10. The user logs into a secure web
site and gets his/her own virtual desktop (Xvfb.) x11vnc's SSL
enabled Java Viewer Applet is launched by the web browser for
secure viewing (and so no software needs to be installed on the
viewer-side.) One can use the desktop.cgi script for ideas to
create their own fancier or customized web login desktop service
(e.g. user-creation, PHP, SQL, specialized desktop application,
etc.) More info here. There is also an optional 'port redirection'
mode that allows redirection to other SSL enabled VNC servers
running inside the firewall.
* Built-in support for IPv6 (128 bit internet addresses) is now
provided. See the -6 and -connect options for details.
Additionally, in case there are still problems with built-in IPv6
support, a transitional tool is provided in inet6to4 that allows
x11vnc (or any other IPv4 application) to receive connections over
IPv6.
* The Xdummy wrapper script for Xorg's dummy driver is updated and
no longer requires being run as root. New service options are
provided to select Xdummy over Xvfb as the virtual X server to be
created.
* The "%" unix password verification tricks for the -unixpw option
are now documented. They have also been extended to run a command
as the user if one sets the environment variable UNIXPW_CMD. The
desktop.cgi demo script takes advantage of this new feature.
* A bug has been fixed that would prevent the Java applet viewer
from being downloaded successfully in single-port HTTPS/VNC inetd
mode. The env. var. X11VNC_HTTPS_DOWNLOAD_WAIT_TIME can be used to
adjust for how many seconds a -inetd or -https httpd download is
waited for (default 15 seconds.) The applet will now autodetect
x11vnc and use GET=1 for faster connecting. Many other
improvements and fixes.
* The TightVNC security type (TightVNC features enabler) now works
for RFB version 3.8.
* The X property X11VNC_TRAP_XRANDR can be set on a desktop to force
x11vnc to use the -xrandr screen size change trapping code.
* New remote control query options: pointer_x, pointer_y,
pointer_same, pointer_root, and pointer_mask. A demo script using
them misc/panner.pl is provided.
* The -sslScripts option prints out the SSL certificate management
scripts.
Here are some features that appeared in the 0.9.9 release (Dec/2009):
* The -unixpw_system_greeter option, when used in combined unixpw
and XDMCP FINDCREATEDISPLAY mode (for example: -xdmsvc), enables
the user to press Escape to jump directly to the XDM/GDM/KDM login
greeter screen. This way the user avoids entering his unix
password twice at X session creation time. Also, the unixpw login
panel now has a short help displayed if the user presses 'F1'.
* x11vnc now tries to be a little bit more aggressive in keeping up
with VNC client's framebuffer update requests. Some broken VNC
clients like Eggplant and JollysFastVNC continuously spray these
requests at VNC servers (regardless of whether they have received
any updates or not.) Under some circumstances this could lead to
x11vnc falling behind. The -extra_fbur option allows one to fine
tune the setting. Additionally, one may also dial down delays:
e.g. "-defer 5" and "-wait 5" (or to 1 or even 0) or -nonap or
-allinput to keep up with these VNC clients at the expense of
increased system load.
* Heuristics are applied to try to determine if the X display is
currently in a Display Manager Greeter Login panel (e.g. GDM) If
so, x11vnc's creation of any windows and use of XFIXES are
delayed. This is to try to avoid x11vnc being killed after the
user logs in if the GDM KillInitClients=true is in effect. So one
does not need to set KillInitClients=false. Note that in recent
GDM the KillInitClients option has been removed. Also delayed is
the use of the XFIXES cursor fetching functionality; this avoids
an Xorg bug that causes Xorg to crash right after the user logs
in.
* A new option -findauth runs the FINDDISPLAY script that applies
heuristics that try to determine the XAUTHORITY file. The use of
'-auth guess' will use the XAUTHORITY that -findauth reveals. This
can be handy in with the lastest GDM where the ability to store
cookies in ~/.Xauthority has been removed. If x11vnc is running as
root (e.g. inetd) and you add -env FD_XDM=1 to the above -findauth
or -auth guess command lines, it will find the correct XAUTHORITY
for the given display (this works for XDM/GDM/KDM if the login
greeter panel is up or if someone has already logged into an X
session.)
* The FINDDISPLAY and FINDCREATEDISPLAY modes (i.e. "-display
WAIT:cmd=...", -find, -create) now work correctly for the
user-supplied login program scheme "-unixpw_cmd ...", as long as
the login program supports running commands specified in the
environment variable "RFB_UNIXPW_CMD_RUN" as the logged-in user.
The mode "-unixpw_nis ..." has also been made more consistent.
* The -stunnel option (like -ssl but uses stunnel as an external
helper program) now works with the -ssl "SAVE" and "TMP" special
certificate names. The -sslverify and -sslCRL options now work
correctly in -stunnel mode. Single port HTTPS connections are also
supported for this mode.
* There is an experimental Application Sharing mode that improves
upon the -id/-sid single window sharing: -appshare (run "x11vnc
-appshare -help" for more info.) It is still very primitive and
approximate, but at least it displays multiple top-level windows.
* The remote control command -R can be used to instruct x11vnc to
resend its most recent copy of the Clipboard, Primary, or
Cutbuffer selections: "x11vnc -R resend_clipboard", "x11vnc -R
resend_primary", and "x11vnc -R resend_cutbuffer".
* The fonts in the GUI (-gui) can now by set via environment
variables, e.g. -env X11VNC_FONT_BOLD='Helvetica -16 bold' and
-env X11VNC_FONT_FIXED='Courier -14'.
* The XDAMAGE mechanism is now automatically disabled for a period
of time if a game or screensaver generates too many XDAMAGE
rectangles per second. This avoids the X11 event queue from
soaking up too much memory.
* There is an experimental workaround: "-env X11VNC_WATCH_DX_DY=1"
that tries to avoid problems with poorly constructed menu themes
that place the initial position of the mouse cursor inside a menu
item's active zone. More information can be found here.
Here are some features that appeared in the 0.9.8 release (Jul/2009):
* Stability improvements to -threads mode. Running x11vnc this way
is more reliable now. Threaded operation sometimes gives better
interactive response and faster updates: try it out. The threaded
mode now supports multiple VNC viewers using the same VNC
encoding. The threaded mode can also yield a performance
enhancement in the many client case (e.g. class-room broadcast.)
We have tested with 30 to 50 simultaneous clients. See also
-reflect.
For simultaneous clients: the ZRLE encoding is thread safe on all
platforms, and the Tight and Zlib encodings are currently only
thread safe on Linux where thread local storage, __thread, is
used. If your non-Linux system and compiler support __thread one
can supply -DTLS=__thread to enable it. When there is only one
connected client, all encodings are safe on all platforms. Note
that some features (e.g. scroll detection and -ncache) may be
disabled or run with reduced functionality in -threads mode.
* Automatically tries to work around an Xorg server and GNOME bug
involving infinitely repeating keys when turning off key
repeating. Use -repeat if the automatic workaround fails.
* Improved reliability of the Single Port SSL VNC and HTTPS java
viewer applet delivery mechanism.
* The -clip mode works under -rawfb.
Here are some features that appeared in the 0.9.7 release (Mar/2009):
* Support for polling Linux Virtual Terminals (also called virtual
consoles) directly instead of using /dev/fb. The option to use is,
for example, "-rawfb vt2" for Virtual Terminal 2, etc. In this
case the special file /dev/vcsa2 is used to retrieve vt2's current
text. Text and colors are shown, but no graphics.
* Support for less than 8 bits per pixel framebuffers (e.g. 4 or 1
bpp) in the -rawfb mode.
* The SSL enabled UltraVNC Java viewer applet now has a [Home] entry
in the "drives" drop down menu. This menu can be configured with
the ftpDropDown applet parameter. All of the applet parameters are
documented in classes/ssl/README.
* Experimental support for VirtualGL's TurboVNC (an enhanced
TightVNC for fast LAN high framerate usage.)
* The CUPS Terminal Services helper mode has been improved.
* Improvements to the -ncache_cr that allows smooth opaque window
motions using the 'copyrect' encoding when using -ncache mode.
* The -rmflag option enables a way to indicate to other processes
x11vnc has exited.
* Reverse connections using anonymous Diffie Hellman SSL encryption
now work.
Here are some features that appeared in the 0.9.6 release (Dec/2008):
* Support for VeNCrypt SSL/TLS encrypted connections. It is enabled
by default in the -ssl mode. VNC Viewers like vinagre,
gvncviewer/gtk-vnc, the vencrypt package, SSVNC, and others
support this encryption mode. It can also be used with the -unixpw
option to enable Unix username and password authentication
(VeNCrypt's "*Plain" modes.) A similar but older VNC security type
"ANONTLS" (used by vino) is supported as well. See the -vencrypt
and -anontls options for additional control. The difference
between x11vnc's normal -ssl mode and VeNCrypt is that the former
wraps the entire VNC connection in SSL (like HTTPS does for HTTP,
i.e. "vncs://") while VeNCrypt switches on the SSL/TLS at a
certain point during the VNC handshake. Use -sslonly to disable
both VeNCrypt and ANONTLS (vino.)
* The "-ssl ANON" option enables Anonymous Diffie-Hellman (ADH) key
exchange for x11vnc's normal SSL/TLS operation. Note that
Anonymous Diffie-Hellman uses encryption for privacy, but provides
no authentication and so is susceptible to Man-In-The-Middle
attacks (and so we do not recommend it: we prefer you use "-ssl
SAVE", etc. and have the VNC viewer verify the cert.) The ANONTLS
mode (vino) only supports ADH. VeNCrypt mode supports both ADH and
regular X509 SSL certificates modes. For these ADH is enabled by
default. See -vencrypt and -anontls for how to disable ADH.
* For x11vnc's SSL/TLS modes, one can now specify a Certificate
Revocation List (CRL) with the -sslCRL option. This will only be
useful for wide deployments: say a company-wide x11vnc SSL access
deployment using a central Certificate Authority (CA) via
-sslGenCA and -sslGenCert. This way if a user has his laptop lost
or stolen, you only have to revoke his key instead of creating a
new Certificate Authority and redeploying new keys to all users.
* The default SSL/TLS mode, "-ssl" (no pem file parameter supplied),
is now the same as "-ssl SAVE" and will save the generated
self-signed cert in "~/.vnc/certs/server.pem". Previously "-ssl"
would create a temporary self-signed cert that was discarded when
x11vnc exited. The reason for the change is to at least give the
chance for the VNC Viewer side (e.g. SSVNC) to remember the cert
to authenticate subsequent connections to the same x11vnc server.
Use "-ssl TMP" to regain the previous behavior. Use "-ssl
SAVE_NOPROMPT" to avoid being prompted about using passphrase when
the certificate is created.
* The option -http_oneport enables single-port HTTP connections via
the Java VNC Viewer. So, for example, the web browser URL
"http://myhost.org:5900" works the same as
"http://myhost.org:5800", but with the convenience of only
involving one port instead of two. This works for both unencrypted
connections and for SSH tunnels (see -httpsredir if the tunnel
port differs.) Note that HTTPS single-port operation in -ssl SSL
encrypted mode has been available since x11vnc version 0.8.3.
* For the -avahi/-zeroconf Service Advertizing mode, if x11vnc was
not compiled with the avahi-client library, then an external
helper program, either avahi-publish(1) (on Unix) or dns-sd(1) (on
Mac OS X), is used instead.
* The "-rfbport PROMPT" option will prompt the user via the GUI to
select the VNC port (e.g. 5901) to listen on, and a few other
basic settings. This enables a handy GUI mode for naive users:
x11vnc -gui tray=setpass -rfbport PROMPT -logfile $HOME/.x11vnc.log.%VNCDISP
LAY
suitable for putting in a launcher or menu, e.g. x11vnc.desktop.
The -logfile expansion is new too. In the GUI, the tray=setpass
Properties panel has been improved.
* The -solid solid background color option now works for the Mac OS
X console.
* The -reopen option instructs x11vnc to try to reopen the X display
if it is prematurely closed by, say, the display manager (e.g.
GDM.)
Here are some features that appeared in the 0.9.5 release (Oct/2008):
* Symmetric key encryption ciphers. ARC4, AES-128, AES-256,
blowfish, and 3des are supported. Salt and initialization vector
seeding is provided. These compliment the more widely used SSL and
SSH encryption access methods. SSVNC also supports these
encryption modes.
* Scaling differently along the X- and Y-directions. E.g. "-scale
1280x1024" or "-scale 0.8x0.75" Also, "-geometry WxH" is an
alias for "-scale WxH"
* By having SSVNC version 1.0.21 or later available in your $PATH,
the -chatwindow option allows a UltraVNC Text Chat window to
appear on the local X11 console/display (this way the remote
viewer can chat with the person at the physical display; e.g.
helpdesk mode.) This also works on the Mac OS X console if the
Xquartz X11 server (enabled by default on leopard) is running for
the chatwindow.
* The HTTP Java viewer applet jar, classes/VncViewer.jar, has been
updated with an improved implementation based on the code used by
the classes/ssl applets.
Here are some features that appeared in the 0.9.4 release (Sep/2008):
* Improvements to the -find and -create X session finding or
creating modes: new desktop types and service redirection options.
Personal cupsd daemon and SSH port redirection helper for use with
SSVNC's Terminal Services feature.
* Reverse VNC connections via -connect work in the -find, -create
and related -display WAIT:... modes.
* Reverse VNC connections (either normal or SSL) can use a Web Proxy
or a SOCKS proxy, or a SSH connection, or even a CGI URL to make
the outgoing connection. See: -proxy. Forward connections can also
use: -ssh.
* Reverse VNC connections via the UltraVNC repeater proxy (either
normal or SSL) are supported. Use either the "-connect
repeater=ID:NNNN+host:port" or "-connect
repeater://host:port+ID:NNNN" notation. The SSVNC VNC viewer also
supports the UltraVNC repeater. Also, a perl repeater implemention
is here: ultravnc_repeater.pl
* Support for indexed colormaps (PseudoColor) with depths other than
8 (from 1 to 16 now work) for non-standard hardware. Option
"-advertise_truecolor" to handle some workaround in this mode.
* Support for the ZYWRLE encoding, this is the RealVNC ZRLE encoding
extended to do motion video and photo regions more efficiently by
way of a Wavelet based transformation.
* The -finddpy and -listdpy utilities help to debug and configure
the -find, -create, and -display WAIT:... modes.
* Some automatic detection of screen resizes are handled even if the
-xrandr option is not supplied.
* The -autoport options gives more control over the VNC port x11vnc
chooses.
* The -ping secs can be used to help keep idle connections alive.
* Pasting of the selection/clipboard into remote applications (e.g.
Java) has been improved.
* Fixed a bug if a client disconnects during the 'speed-estimation'
phase.
* To unset Caps_Lock, Num_Lock and raise all keys in the X server
use -clear_all.
* Usage with dvorak keyboards has been improved. See also: -xkb.
* The Java Viewer applet source code is now included in the
x11vnc-0.9.*.tar.gz tarball. This means you can now build the Java
viewer applet jar files from source. If you stopped shipping the
Java viewer applet jar files due to lack of source code, you can
start again.
Here are some features that appeared in the 0.9.3 release (Oct/2007):
* Viewer-side pixmap caching. A large area of pixels (at least 2-3
times as big as the framebuffer itself; the bigger the better...
default is 10X) is placed below the framebuffer to act as a
buffer/cache area for pixel data. The VNC CopyRect encoding is
used to move it around, so any viewer can take advantage of it.
Until we start modifying viewers you will be able to see the cache
area if you scroll down (this makes it easier to debug!) For
testing the default is "-ncache 10". The unix Enhanced TightVNC
Viewer ssvnc has a nice -ycrop option to help hide the pixel cache
area from view.
Here are some features that appeared in the 0.9.2 release (Jun/2007):
* Building with no OpenSSL libssl available (or with --without-ssl)
has been fixed.
* One can configure x11vnc via "./configure
--with-system-libvncserver" to use a system installed libvncserver
library instead of the one bundled in the release tarball.
* If UltraVNC file transfer or chat is detected, then VNC clients
are "pinged" more often to prevent these side channels from
becoming serviced too infrequently.
* In -unixpw mode in the username and password dialog no text will
be echoed if the first character sent is "Escape". This enables a
convenience feature in SSVNC to send the username and password
automatically.
Here are some features that appeared in the 0.9.1 release (May/2007):
* The UltraVNC Java viewer has been enhanced to support SSL (as the
TightVNC viewer had been previously.) The UltraVNC Java supports
ultravnc filetransfer, and so can be used as a VNC viewer on Unix
that supports ultravnc filetransfer. It is in the
classes/ssl/UltraViewerSSL.jar file (that is pointed to by
ultra.vnc.) The signed applet SignedUltraViewerSSL.jar version
(pointed to by ultrasigned.vnc) will be needed to access the local
drive if you are using it for file transfer via a Web browser.
Some other bugs in the UltraVNC Java viewer were fixed and a few
improvements to the UI made.
* A new Unix username login mode for VNC Viewers authenticated via a
Client SSL Certificate: "-users sslpeer=". The emailAddress
subject field is inspected for username@hostname and then acts as
though "-users +username" has been supplied. This way the Unix
username is identified by (i.e. simply extracted from) the Client
SSL Certificate. This could be useful with -find, -create and -svc
modes if you are also have set up and use VNC Client SSL
Certificate authentication.
* For external display finding/creating programs (e.g. WAIT:cmd=...)
if the VNC Viewer is authenticated via a Client SSL Certificate,
then that Certificate is available in the environment variable
RFB_SSL_CLIENT_CERT.
Here are some features that appeared in the 0.9 release (Apr/2007):
* VNC Service advertising via mDNS / ZeroConf / BonJour with the
Avahi client library. Enable via "-avahi" or "-zeroconf".
* Implementations of UltraVNC's TextChat, SingleWindow, and
ServerInput extensions (requires ultravnc viewer or ssvnc Unix
viewer.) They toggle the selection of a single window (-id), and
disable (friendly) user input and viewing (monitor blank) at the
VNC server.
* Short aliases "-find", "-create", "-svc", and "-xdmsvc" for
commonly used FINDCREATEDISPLAY usage modes.
* Reverse VNC connections (viewer listening) now work in SSL (-ssl)
mode.
* New options to control the Monitor power state and keyboard/mouse
grabbing: -forcedpms, -clientdpms, -noserverdpms, and -grabalways.
* A simple way to emulate inetd(8) to some degree via the "-loopbg"
option.
* Monitor the accuracy of XDAMAGE and apply "-noxdamage" if it is
not working well. OpenGL applications like like beryl and MythTv
have been shown to make XDAMAGE not work properly.
* For Java SSL connections involving a router/firewall port
redirection, an option -httpsredir to spare the user from needing
to include &PORT=NNN in the browser URL.
Here are some features that appeared in the 0.8.4 release (Feb/2007):
* Native Mac OS X Aqua/Quartz support. (i.e. OSXvnc alternative;
some activities are faster)
* A new login mode: "-display WAIT:cmd=FINDCREATEDISPLAY -unixpw
..." that will Create a new X session (either virtual or real and
with or without a display manager, e.g. kdm) for the user if it
cannot find the user's X session display via the FINDDISPLAY
method. See the -svc and the -xdmsvc aliases.
* x11vnc can act as a VNC reflector/repeater using the "-reflect
host:N" option. Instead of polling an X display, the remote VNC
Server host:N is connected to and re-exported via VNC. This is
intended for use in broadcasting a display to many (e.g. > 16;
classroom or large demo) VNC viewers where bandwidth and other
resources are conserved by spreading the load over a number of
repeaters.
* Wireframe copyrect detection for local user activity (e.g. someone
sitting at the physical display moving windows) Use
-nowireframelocal to disable.
* The "-N" option couples the VNC Display number to the X Display
number. E.g. if your X DISPLAY is :2 then the VNC display will be
:2 (i.e. using port 5902.) If that port is taken x11vnc will exit.
* Option -nodpms to avoid problems with programs like KDE's
kdesktop_lock that keep restarting the screen saver every few
seconds.
* To automatically fix the common mouse motion problem on XINERAMA
(multi-headed) displays, the -xwarppointer option is enabled by
default when XINERAMA is active.
If you have a Mac please try out the native Mac OS X support, build
with "./configure --without-x", or download a binary mentioned above,
(even if you don't plan on ever using it in this mode!), and let me
know how it went. Thanks.
Here are some features that appeared in the 0.8.3 release (Nov/2006):
* The -ssl option provides SSL encryption and authentication
natively via the www.openssl.org library. One can use from a
simple self-signed certificate server certificate up to full CA
and client certificate authentication schemes.
* Similar to -ssl, the -stunnel option starts up a SSL tunnel server
stunnel (that must be installed separately on the system:
stunnel.mirt.net ) to allow only encrypted SSL connections from
the network.
* The -sslverify option allows for authenticating VNC clients via
their certificates in either -ssl or -stunnel modes.
* Certificate creation and management tools are provide in the
-sslGenCert, -sslGenCA, and related options.
* An SSL enabled Java applet VNC Viewer applet is provided by x11vnc
in classes/ssl/VncViewer.jar. In addition to normal HTTP, the
applet may be loaded into the web browser via HTTPS (HTTP over
SSL.) (one can use the VNC port, e.g. https://host:5900/, or also
the separate -https port option.) A wrapper shell script
ss_vncviewer is also provided that sets up a stunnel client-side
tunnel on Unix systems. See Enhanced TightVNC Viewer (SSVNC) for
other SSL/SSH viewer possibilities.
* The -unixpw option supports Unix username and password
authentication (a simpler variant is the -unixpw_nis option that
works in environments where the encrypted passwords are readable,
e.g. NIS.) The -ssl or -localhost + -stunnel options are enforced
in this mode to prevent password sniffing. As a convenience, these
requirements are lifted if a SSH tunnel can be deduced (but
-localhost still applies.)
* Coupling -unixpw with "-display WAIT:cmd=FINDDISPLAY" or "-display
WAIT:cmd=FINDCREATEDISPLAY" provides a way to allow a user to
login with their UNIX password and have their display connected to
automatically. See the -svc and the -xdmsvc aliases.
* Hooks are provided in the -unixpw_cmd and "-passwdfile
cmd:,custom:..." options to allow you to supply your own
authentication and password lookup programs.
* x11vnc can be configured and built to not depend on X11 libraries
"./configure --without-x" for -rawfb only operation (e.g. embedded
linux console devices.)
* The -rotate option enables you to rotate or reflect the screen
before exporting via VNC. This is intended for use on handhelds
and other devices where the rotation orientation is not "natural".
* The "-ultrafilexfer" alias is provided and improved UltraVNC
filetransfer rates have been achieved.
* Under the "-connect_or_exit host" option x11vnc will exit
immediately unless the reverse connection to host succeeds. The
"-rfbport 0" option disables TCP listening for connections (useful
for this mode.)
* The "-rawfb rand" and "-rawfb none" options are useful for testing
automation scripts, etc., without requiring a full desktop.
* Reduced spewing of information at startup, use "-verbose" (also
"-v") to turn it back on for debugging or if you are going to send
me a problem report.
# Here are some Previous Release Notes
## Some Notes:
Both a client and a server: It is sometimes confusing to people that
x11vnc is both a client and a server at the same time. It is an X
client because it connects to the running X server to do the screen
polls. Think of it as a rather efficient "screenshot" program running
continuously. It is a server in the sense that it is a VNC server that
VNC viewers on the network can connect to and view the screen
framebuffer it manages.
When trying to debug problems, remember to think of both roles. E.g.
"how is x11vnc connecting to the X server?", "how is the vncviewer
connecting to x11vnc?", "what permits/restricts the connection?". Both
links may have reachability, permission, and other issues.
Network performance: Whether you are using Xvnc or x11vnc it is
always a good idea to have a solid background color instead of a
pretty background image. Each and every re-exposure of the background
must be resent over the network: better to have that background be a
solid color that compresses very well compared to a photo image. (This
is one place where the X protocol has an advantage over the VNC
protocol.) I suggest using xsetroot, dtstyle or similar utility to set
a solid background while using x11vnc. You can turn the pretty
background image back on when you are using the display directly.
Update: As of Feb/2005 x11vnc has the -solid [color] option that works
on recent GNOME, KDE, and CDE and also on classic X (background image
is on the root window.) Update: As of Oct/2007 x11vnc has the -ncache
option that does a reasonable job caching the background (and other)
pixmap data on the viewer side.
I also find the TightVNC encoding gives the best response for my usage
(Unix <-> Unix over cable modem.) One needs a tightvnc-aware vncviewer
to take advantage of this encoding.
TCP port issues: Notice the lines
```
18/07/2003 14:36:31 Autoprobing selected port 5900
PORT=5900
```
in the output. 5900 is the default VNC listening port (just like 6000
is X11's default listening port.) Had port 5900 been taken by some
other application, x11vnc would have next tried 5901. That would mean
the viewer command above should be changed to vncviewer
far-away.east:1. You can force the port with the "-rfbport NNNN"
option where NNNN is the desired port number. If that port is already
taken, x11vnc will exit immediately. The "-N" option will try to match
the VNC display number to the X display. (also see the "SunRay
Gotcha" note below)
Options: x11vnc has (far too) many features that may be activated
via its command line options. Useful options are, e.g., -scale to do
server-side scaling, and -rfbauth passwd-file to use VNC password
protection (the vncpasswd or storepasswd programs, or the x11vnc
-storepasswd option can be used to create the password file.)
Algorithm: How does x11vnc do it? Rather brute-forcedly: it
continuously polls the X11 framebuffer for changes using
XShmGetImage(). When changes are discovered, it instructs libvncserver
which rectangular regions of the framebuffer have changed, and
libvncserver compresses the changes and sends them off to any
connected VNC viewers. A number of applications do similar things,
such as x0rfbserver, krfb, x0vncserver, vino. x11vnc uses a 32 x 32
pixel tile model (the desktop is decomposed into roughly 1000 such
tiles), where changed tiles are found by pseudo-randomly polling 1
pixel tall horizontal scanlines separated vertically by 32 pixels.
This is a surprisingly effective algorithm for finding changed
regions. For keyboard and mouse user input the XTEST extension is used
to pass the input events to the X server. To detect XBell "beeps" the
XKEYBOARD extension is used. If available, the XFIXES extension is
used to retrieve the current mouse cursor shape. Also, if available
the X DAMAGE extension is used to receive hints from the X server
where modified regions on the screen are. This greatly reduces the
system load when not much is changing on the screen and also improves
how quickly the screen is updated.
Barbershop mirrors effect: What if x11vnc is started up, and
vncviewer is then started up on the same machine and displayed on the
same display x11vnc is polling? One might "accidentally" do this when
first testing out the programs. You get an interesting
recursive/feedback effect where vncviewer images keep popping up each
one contained in the previous one and slightly shifted a bit by the
window manager decorations. There will be an even more interesting
effect if -scale is used. Also, if the XKEYBOARD is supported and the
XBell "beeps" once, you get an infinite loop of beeps going off.
Although all of this is mildly exciting it is not much use: you will
normally run and display the viewer on a different machine!
## Sun Ray Notes:
You can run x11vnc on your (connected or disconnected) SunRay session.
Here are some notes on SunRay usage with x11vnc.
## Limitations:
* Due to the polling nature, some activities (opaque window moves,
scrolling), can be pretty choppy/ragged and others (exposures of
large areas) slow. Experiment with interacting a bit differently
than you normally do to minimize the effects (e.g. do fullpage
paging rather than line-by-line scrolling, and move windows in a
single, quick motion.) Recent work has provided the
-scrollcopyrect and -wireframe speedups using the CopyRect VNC
encoding and other things, but they only speed up some activities,
not all.
* A rate limiting factor for x11vnc performance is that graphics
hardware is optimized for writing, not reading (x11vnc reads the
video framebuffer for the screen image data.) The difference can
be a factor of 10 to 1000, and so it usually takes about 0.5-1 sec
to read in the whole video hardware framebuffer (e.g. 5MB for
1280x1024 at depth 24 with a read rate of 5-10MB/sec.) So whenever
activity changes most of the screen (e.g. moving or iconifying a
large window) there is a delay of 0.5-1 sec while x11vnc reads the
changed regions in.
A slow framebuffer read rate will often be the performance
bottleneck on a fast LAN (whereas on slower links the reduced
network bandwidth becomes the bottleneck.)
Note: A quick way to get a 2X speedup of this for x11vnc is to
switch your X server from depth 24 (32bpp) to depth 16 (16bpp.)
You get a 4X speedup going to 8bpp, but the lack of color cells is
usually unacceptable.
To get a sense of the read and write speeds of your video card,
you can run benchmarks like: "x11perf -getimage500", "x11perf
-putimage500", "x11perf -shmput500" and for XFree86 displays with
direct graphics access the "dga" command (press "b" to run the
benchmark and then after a few seconds press "q" to quit.) Even
this "dd if=/dev/fb0 of=/dev/null" often gives a good estimate.
x11vnc also prints out its estimate:
28/02/2009 11:11:07 Autoprobing TCP port
28/02/2009 11:11:07 Autoprobing selected port 5900
28/02/2009 11:11:08 fb read rate: 10 MB/sec
28/02/2009 11:11:08 screen setup finished.
We have seen a few cases where the hardware fb read speed is
greater than 65 MB/sec: on high end graphics workstations from SGI
and Sun, and also from a Linux user using nvidia proprietary
drivers for his nvidia video card. Update 2008: thankfully, these
sped up drivers are becoming more common on Linux and *BSD systems
and that makes x11vnc run somewhat more quickly. Sometimes they
have a read rate of over 400 MB/sec.
On XFree86/Xorg it is actually possible to increase the
framebuffer read speed considerably (10-100 times) by using the
Shadow Framebuffer (a copy of the framebuffer is kept in main
memory and this can be read much more quickly.) To do this one
puts the line Option "ShadowFB" "true" in the Device section of
the /etc/X11/XF86Config or /etc/X11/xorg.conf file. Note that this
disables 2D acceleration at the physical display and so that might
be unacceptable if one plays games, etc. on the machine's local
display. Nevertheless this could be handy in some circumstances,
e.g. if the slower speed while sitting at the physical display was
acceptable (this seems to be true for most video cards these
days.) Unfortunately it does not seem shadowfb can be turned on
and off dynamically...
Another amusing thing one can do is use Xvfb as the X server, e.g.
"xinit $HOME/.xinitrc -- /usr/X11R6/bin/Xvfb :1 -screen 0
1024x768x16" x11vnc can poll Xvfb efficiently via main memory.
It's not exactly clear why one would want to do this instead of
using vncserver/Xvnc, (perhaps to take advantage of an x11vnc
feature, such as framebuffer scaling or built-in SSL encryption),
but we mention it because it may be of use for special purpose
applications. You may need to use the "-cc 4" option to force Xvfb
to use a TrueColor visual instead of DirectColor. See also the
description of the -create option that does all of this
automatically for you (be sure to install the Xvfb package, e.g.
apt-get install xvfb.)
Also, a faster and more accurate way is to use the "dummy"
Xorg/XFree86 device driver (or our Xdummy wrapper script.) See
this FAQ for details.
* Somewhat surprisingly, the X11 mouse (cursor) shape is write-only
and cannot be queried from the X server. So traditionally in
x11vnc the cursor shape stays fixed at an arrow. (see the "-cursor
X" and "-cursor some" options, however, for a partial hack for the
root window, etc.) However, on Solaris using the SUN_OVL overlay
extension, x11vnc can show the correct mouse cursor when the
-overlay option is also supplied. A similar thing is done on IRIX
as well when -overlay is supplied.
More generally, as of Dec/2004 x11vnc supports the new XFIXES
extension (in Xorg and Solaris 10) to query the X server for the
exact cursor shape, this works pretty well except that cursors
with transparency (alpha channel) need to approximated to solid
RGB values (some cursors look worse than others.)
* Audio from applications is of course not redirected (separate
redirectors do exist, e.g. esd, see the FAQ on this below.) The
XBell() "beeps" will work if the X server supports the XKEYBOARD
extension. (Note that on Solaris XKEYBOARD is disabled by default.
Passing +kb to Xsun enables it.)
* The scroll detection algorithm for the -scrollcopyrect option can
give choppy or bunched up transient output and occasionally
painting errors.
* Using -threads can expose some bugs/crashes in libvncserver.
Please feel free to contact me if you have any questions, problems, or
comments about x11vnc, etc. Please be polite, thorough, and not
demanding (sadly, the number of people contacting me that are rude and
demanding is increasing dramatically.)
Also, some people ask if they can make a donation, see this link for
that.
http://www.karlrunge.com/x11vnc/faq.html:
# x11vnc FAQ:
[Building and Starting]
Q-1: I can't get x11vnc to start up. It says "XOpenDisplay failed
(null)" or "Xlib: connection to ":0.0" refused by server Xlib: No
protocol specified" and then exits. What do I need to do?
Q-2: I can't get x11vnc and/or libvncserver to compile.
Q-3: I just built x11vnc successfully, but when I use it my keystrokes
and mouse button clicks are ignored (I am able to move the mouse
though.)
Q-4: Help, I need to run x11vnc on Solaris 2.5.1 (or other old
Unix/Linux) and it doesn't compile!
Q-5: Where can I get a precompiled x11vnc binary for my Operating
System?
Q-6: Where can I get a VNC Viewer binary (or source code) for the
Operating System I will be viewing from?
Q-7: How can I see all of x11vnc's command line options and
documentation on how to use them?
Q-8: I don't like typing arcane command line options every time I
start x11vnc. What can I do? Is there a config file? Or a GUI?
Q-9: How can I get the GUI to run in the System Tray, or at least be a
smaller, simpler icon?
Q-10: How can I get x11vnc to listen on a different port besides the
default VNC port (5900)?
Q-11: My Firewall/Router doesn't allow VNC Viewers to connect to
x11vnc.
Q-12: Is it possible for a VNC Viewer and a VNC Server to connect to
each other even though both are behind Firewalls that block all
incoming connections?
Q-13: Can I make x11vnc more quiet and also go into the background
after starting up?
Q-14: Sometimes when a VNC viewer dies abruptly, x11vnc also dies with
the error message like: "Broken pipe". I'm using the -forever mode and
I want x11vnc to keep running.
Q-15: The Windows TightVNC 1.3.9 Viewer cannot connect to x11vnc.
Q-16: KDE's krdc VNC viewer cannot connect to x11vnc.
Q-17: When I start x11vnc on an Alpha Tru64 workstation the X server
crashes!
Q-18: When running x11vnc on an IBM AIX workstation after a few
minutes the VNC connection freezes.
Q-19: Are there any build-time customizations possible, e.g. change
defaults, create a smaller binary, etc?
[Win2VNC Related]
Q-20: I have two separate machine displays in front of me, one Windows
the other X11: can I use x11vnc in combination with Win2VNC in
dual-screen mode to pass the keystrokes and mouse motions to the X11
display?
Q-21: I am running Win2VNC on my Windows machine and "x11vnc -nofb" on
Unix to pass keyboard and mouse to the Unix monitor. Whenever I start
Win2VNC it quickly disconnects and x11vnc says:
rfbProcessClientNormalMessage: read: Connection reset by peer
Q-22: Can I run "x11vnc -nofb" on a Mac OS X machine to redirect mouse
and keyboard input to it from Windows and X11 machines via Win2VNC and
x2vnc, respectively?
[Color Issues]
Q-23: The X display I run x11vnc on is only 8 bits per pixel (bpp)
PseudoColor (i.e. only 256 distinct colors.) The x11vnc colors may
start out OK, but after a while they are incorrect in certain windows.
Q-24: Color problems: Why are the colors for some windows incorrect in
x11vnc? BTW, my X display has nice overlay/multi-depth visuals of
different color depths: e.g. there are both depth 8 and 24 visuals
available at the same time.
Q-25: I am on a high color system (depth >= 24) but I seem to have
colormap problems. They either flash or everything is very dark.
Q-26: How do I figure out the window id to supply to the -id windowid
option?
Q-27: Why don't menus or other transient windows come up when I am
using the -id windowid option to view a single application window?
Q-28: My X display is depth 24 at 24bpp (instead of the normal depth
24 at 32bpp.) I'm having lots of color and visual problems with x11vnc
and/or vncviewer. What's up?
[Xterminals]
Q-29: Can I use x11vnc to view and interact with an Xterminal (e.g.
NCD) that is not running UNIX and so x11vnc cannot be run on it
directly?
Q-30: How do I get my X permissions (MIT-MAGIC-COOKIE file) correct
for a Unix/Linux machine acting as an Xterminal?
[Sun Rays]
Q-31: I'm having trouble using x11vnc with my Sun Ray session.
[Remote Control]
Q-32: How do I stop x11vnc once it is running in the background?
Q-33: Can I change settings in x11vnc without having to restart it?
Can I remote control it?
[Security and Permissions]
Q-34: How do I create a VNC password for use with x11vnc?
Q-35: Can I make it so -storepasswd doesn't show my password on the
screen?
Q-36: Can I have two passwords for VNC viewers, one for full access
and the other for view-only access to the display?
Q-37: Can I have as many full-access and view-only passwords as I
like?
Q-38: Does x11vnc support Unix usernames and passwords? Can I further
limit the set of Unix usernames who can connect to the VNC desktop?
Q-39: Can I supply an external program to provide my own custom login
method (e.g. Dynamic/One-time passwords or non-Unix (LDAP) usernames
and passwords)?
Q-40: Why does x11vnc exit as soon as the VNC viewer disconnects? And
why doesn't it allow more than one VNC viewer to connect at the same
time?
Q-41: Can I limit which machines incoming VNC clients can connect
from?
Q-42: How do I build x11vnc/libvncserver with libwrap (tcp_wrappers)
support?
Q-43: Can I have x11vnc only listen on one network interface (e.g.
internal LAN) rather than having it listen on all network interfaces
and relying on -allow to filter unwanted connections out?
Q-44: Now that -localhost implies listening only on the loopback
interface, how I can occasionally allow in a non-localhost via the -R
allowonce remote control command?
Q-45: Can I fine tune what types of user input are allowed? E.g. have
some users just be able to move the mouse, but not click or type
anything?
Q-46: Can I prompt the user at the local X display whether the
incoming VNC client should be accepted or not? Can I decide to make
some clients view-only? How about running an arbitrary program to make
the decisions?
Q-47: I start x11vnc as root because it is launched via inetd(8) or a
display manager like gdm(1). Can I have x11vnc later switch to a
different user?
Q-48: I use a screen-lock when I leave my workstation (e.g.
xscreensaver or xlock.) When I remotely access my workstation desktop
via x11vnc I can unlock the desktop fine, but I am worried people will
see my activities on the physical monitor. What can I do to prevent
this, or at least make it more difficult?
Q-49: Can I have x11vnc automatically lock the screen when I
disconnect the VNC viewer?
[Encrypted Connections]
Q-50: How can I tunnel my connection to x11vnc via an encrypted SSH
channel between two Unix machines?
Q-51: How can I tunnel my connection to x11vnc via an encrypted SSH
channel from Windows using an SSH client like Putty?
Q-52: How can I tunnel my connection to x11vnc via an encrypted SSL
channel using an external tool like stunnel?
Q-53: Does x11vnc have built-in SSL tunneling?
Q-54: How do I use VNC Viewers with built-in SSL tunneling?
Q-55: How do I use the Java applet VNC Viewer with built-in SSL
tunneling when going through a Web Proxy?
Q-56: Can Apache web server act as a gateway for users to connect via
SSL from the Internet with a Web browser to x11vnc running on their
workstations behind a firewall?
Q-57: Can I create and use my own SSL Certificate Authority (CA) with
x11vnc?
[Display Managers and Services]
Q-58: How can I run x11vnc as a "service" that is always available?
Q-59: How can I use x11vnc to connect to an X login screen like xdm,
GNOME gdm, KDE kdm, or CDE dtlogin? (i.e. nobody is logged into an X
session yet.)
Q-60: Can I run x11vnc out of inetd(8)? How about xinetd(8)?
Q-61: Can I have x11vnc advertise its VNC service and port via mDNS /
Zeroconf (e.g. Avahi) so VNC viewers on the local network can detect
it automatically?
Q-62: Can I have x11vnc allow a user to log in with her UNIX username
and password and then have it find her X session display on that
machine and then attach to it? How about starting an X session if one
cannot be found?
Q-63: Can I have x11vnc restart itself after it terminates?
Q-64: How do I make x11vnc work with the Java VNC viewer applet in a
web browser?
Q-65: Are reverse connections (i.e. the VNC server connecting to the
VNC viewer) using "vncviewer -listen" and vncconnect(1) supported?
Q-66: Can reverse connections be made to go through a Web or SOCKS
proxy or SSH?
Q-67: Can x11vnc provide a multi-user desktop web login service as an
Apache CGI or PHP script?
Q-68: Can I use x11vnc as a replacement for Xvnc? (i.e. not for a real
display, but for a virtual one I keep around.)
Q-69: How can I use x11vnc on "headless" machines? Why might I want
to?
[Resource Usage and Performance]
Q-70: I have lots of memory, but why does x11vnc fail with shmget:
No space left on device or Minor opcode of failed request: 1
(X_ShmAttach)?
Q-71: How can I make x11vnc use less system resources?
Q-72: How can I make x11vnc use MORE system resources?
Q-73: I use x11vnc over a slow link with high latency (e.g. dialup
modem or broadband), is there anything I can do to speed things up?
Q-74: Does x11vnc support the X DAMAGE Xserver extension to find
modified regions of the screen quickly and efficiently?
Q-75: My OpenGL application shows no screen updates unless I supply
the -noxdamage option to x11vnc.
Q-76: When I drag windows around with the mouse or scroll up and down
things really bog down (unless I do the drag in a single, quick
motion.) Is there anything to do to improve things?
Q-77: Why not do something like wireframe animations to avoid the
windows "lurching" when being moved or resized?
Q-78: Can x11vnc try to apply heuristics to detect when a window is
scrolling its contents and use the CopyRect encoding for a speedup?
Q-79: Can x11vnc do client-side caching of pixel data? I.e. so when
that pixel data is needed again it does not have to be retransmitted
over the network.
Q-80: Does x11vnc support TurboVNC?
[Mouse Cursor Shapes]
Q-81: Why isn't the mouse cursor shape (the little icon shape where
the mouse pointer is) correct as I move from window to window?
Q-82: When using XFIXES cursorshape mode, some of the cursors look
really bad with extra black borders around the cursor and other cruft.
How can I improve their appearance?
Q-83: In XFIXES mode, are there any hacks to handle cursor
transparency ("alpha channel") exactly?
[Mouse Pointer]
Q-84: Why does the mouse arrow just stay in one corner in my
vncviewer, whereas my cursor (that does move) is just a dot?
Q-85: Can I take advantage of the TightVNC extension to the VNC
protocol where Cursor Positions Updates are sent back to all connected
clients (i.e. passive viewers can see the mouse cursor being moved
around by another viewer)?
Q-86: Is it possible to swap the mouse buttons (e.g. left-handed
operation), or arbitrarily remap them? How about mapping button clicks
to keystrokes, e.g. to partially emulate Mouse wheel scrolling?
[Keyboard Issues]
Q-87: How can I get my AltGr and Shift modifiers to work between
keyboards for different languages?
Q-88: When I try to type a "<" (i.e. less than) instead I get ">"
(i.e. greater than)! Strangely, typing ">" works OK!!
Q-89: Extra Character Inserted, E.g.: When I try to type a "<" (i.e.
less than) instead I get "<," (i.e. an extra comma.)
Q-90: I'm using an "international" keyboard (e.g. German "de", or
Danish "dk") and the -modtweak mode works well if the VNC viewer is
run on a Unix/Linux machine with a similar keyboard. But if I run
the VNC viewer on Unix/Linux with a different keyboard (e.g. "us") or
Windows with any keyboard, I can't type some keys like: "@", "$",
"<", ">", etc. How can I fix this?
Q-91: When typing I sometimes get double, triple, or more of my
keystrokes repeated. I'm sure I only typed them once, what can I do?
Q-92: The x11vnc -norepeat mode is in effect, but I still get repeated
keystrokes!!
Q-93: After using x11vnc for a while, I find that I cannot type some
(or any) characters or my mouse clicks and drags no longer have any
effect, or they lead to strange effects. What happened?
Q-94: The machine where I run x11vnc has an AltGr key, but the local
machine where I run the VNC viewer does not. Is there a way I can map
a local unused key to send an AltGr? How about a Compose key as well?
Q-95: I have a Sun machine I run x11vnc on. Its Sun keyboard has just
one Alt key labelled "Alt" and two Meta keys labelled with little
diamonds. The machine where I run the VNC viewer only has Alt keys.
How can I send a Meta keypress? (e.g. emacs needs this)
Q-96: Running x11vnc on HP-UX I cannot type "#" I just get a "3"
instead.
Q-97: Can I map a keystroke to a mouse button click on the remote
machine?
Q-98: How can I get Caps_Lock to work between my VNC viewer and
x11vnc?
[Screen Related Issues and Features]
Q-99: The remote display is larger (in number of pixels) than the
local display I am running the vncviewer on. I don't like the
vncviewer scrollbars, what I can do?
Q-100: Does x11vnc support server-side framebuffer scaling? (E.g. to
make the desktop smaller.)
Q-101: Does x11vnc work with Xinerama? (i.e. multiple monitors joined
together to form one big, single screen.)
Q-102: Can I use x11vnc on a multi-headed display that is not Xinerama
(i.e. separate screens :0.0, :0.1, ... for each monitor)?
Q-103: Can x11vnc show only a portion of the display? (E.g. for a
special purpose application or a very large screen.)
Q-104: Does x11vnc support the XRANDR (X Resize, Rotate and
Reflection) extension? Whenever I rotate or resize the screen x11vnc
just seems to crash.
Q-105: Independent of any XRANDR, can I have x11vnc rotate and/or
reflect the screen that the VNC viewers see? (e.g. for a handheld
whose screen is rotated 90 degrees.)
Q-106: Why is the view in my VNC viewer completely black? Or why is
everything flashing around randomly?
Q-107: I use Linux Virtual Terminals (VT's) to implement 'Fast User
Switching' between users' sessions (e.g. Betty is on Ctrl-Alt-F7,
Bobby is on Ctrl-Alt-F8, and Sid is on Ctrl-Alt-F1: they use those
keystrokes to switch between their sessions.) How come the view in a
VNC viewer connecting to x11vnc is either completely black or
otherwise all messed up unless the X session x11vnc is attached to is
in the active VT?
Q-108: I am using x11vnc where my local machine has "popup/hidden
taskbars" and the remote display where x11vnc runs also has
"popup/hidden taskbars" and they interfere and fight with each other.
What can I do?
Q-109: Help! x11vnc and my KDE screensaver keep switching each other
on and off every few seconds.
Q-110: I am running the compiz 3D window manager (or beryl, MythTv,
Google Earth, or some other OpenGL app) and I do not get screen
updates in x11vnc.
Q-111: Can I use x11vnc to view my VMWare session remotely?
[Exporting non-X11 devices via VNC]
Q-112: Can non-X devices (e.g. a raw framebuffer) be viewed (and even
controlled) via VNC with x11vnc?
Q-113: Can I export the Linux Console (Virtual Terminals) via VNC
using x11vnc?
Q-114: Can I export via VNC a Webcam or TV tuner framebuffer using
x11vnc?
Q-115: Can I connect via VNC to a Qt-embedded/Qt-enhanced/Qtopia
application running on my handheld, cell phone, or PC using the Linux
console framebuffer (i.e. not X11)?
Q-116: How do I inject touch screen input into an
Qt-embedded/Qt-enhanced/Qtopia cell phone such as openmoko/qtmoko Neo
Freerunner?
Q-117: Now that non-X11 devices can be exported via VNC using x11vnc,
can I build it with no dependencies on X11 header files and libraries?
Q-118: How do I cross compile x11vnc for a different architecture than
my Linux i386 or amd64 PC?
Q-119: Does x11vnc support Mac OS X Aqua/Quartz displays natively
(i.e. no X11 involved)?
Q-120: Can x11vnc be used as a VNC reflector/repeater to improve
performance for the case of a large number of simultaneous VNC viewers
(e.g. classroom broadcasting or a large demo)?
Q-121: Can x11vnc be used during a Linux, Solaris, etc. system
Installation so the Installation can be done remotely?
[Misc: Clipboard, File Transfer/Sharing, Printing, Sound, Beeps,
Thanks, etc.]
Q-122: Does the Clipboard/Selection get transferred between the
vncviewer and the X display?
Q-123: Can I use x11vnc to record a Shock Wave Flash (or other format)
video of my desktop, e.g. to record a tutorial or demo?
Q-124: Can I transfer files back and forth with x11vnc?
Q-125: Which UltraVNC extensions are supported?
Q-126: Can x11vnc emulate UltraVNC's Single Click helpdesk mode for
Unix? I.e. something very simple for a naive user to initiate a
reverse vnc connection from their Unix desktop to a helpdesk
operator's VNC Viewer.
Q-127: Can I (temporarily) mount my local (viewer-side) Windows/Samba
File share on the machine where x11vnc is running?
Q-128: Can I redirect CUPS print jobs from the remote desktop where
x11vnc is running to a printer on my local (viewer-side) machine?
Q-129: How can I hear the sound (audio) from the remote applications
on the desktop I am viewing via x11vnc?
Q-130: Why don't I hear the "Beeps" in my X session (e.g. when typing
tput bel in an xterm)?
Q-131: Does x11vnc work with IPv6?
Q-132: Thanks for your program or for your help! Can I make a
donation?
_________________________________________________________________
[Building and Starting]
Q-1: I can't get x11vnc to start up. It says "XOpenDisplay failed
(null)" or "Xlib: connection to ":0.0" refused by server Xlib: No
protocol specified" and then exits. What do I need to do?
For the former error, you need to specify the X display to connect to
(it also needs to be on the same machine the x11vnc process is to run
on.) Set your DISPLAY environment variable (or use the -display
option) to specify it. Nearly always the correct value will be ":0"
(in fact, x11vnc will now assume :0 if given no other information.)
For the latter error, you need to set up the X11 permissions
correctly.
To make sure X11 permissions are the problem do this simple test:
while sitting at the physical X display open a terminal window
(gnome-terminal, xterm, etc.) You should be able to run x11vnc
successfully without any need for special steps or command line
options in that terminal (i.e. just type "x11vnc".) If that works OK
then you know X11 permissions are the only thing preventing it from
working when you try to start x11vnc via, say, a remote shell.
How to Solve: See the xauth(1), Xsecurity(7), and xhost(1) man pages
or this Howto for much info on X11 permissions. For example, you may
need to set your XAUTHORITY environment variable (or use the -auth
option) to point to the correct MIT-MAGIC-COOKIE file (e.g.
/home/joe/.Xauthority or /var/gdm/:0.Xauth or /var/lib/kdm/A:0-crWk72K
or /tmp/.gdmzndVlR, etc, etc.), or simply be sure you run x11vnc as
the correct user (i.e. the user who is logged into the X session you
wish to view.)
Note: The MIT cookie file contains the secret key that allows x11vnc
to connect to the desired X display.
If, say, sshd has set XAUTHORITY to point to a random file it has
created for X forwarding that will cause problems. (Under some
circumstances even su(1) and telnet(1) can set XAUTHORITY. See also
the gdm parameter NeverPlaceCookiesOnNFS that sets XAUTHORITY to a
random filename in /tmp for the whole X session.)
Running x11vnc as root is often not enough: you need to know where the
MIT-MAGIC-COOKIE file for the desired X display is.
Example solution:
x11vnc -display :0 -auth /var/gdm/:0.Xauth
(this is for the display manager gdm and requires root permission to
read the gdm cookie file, see this faq for other display manager
cookie file names.)
Note as of Feb/2007 you can also try the -find option instead of
"-display ..." and see if that finds your display and Xauthority.
Less safe, but to avoid figuring out where the correct XAUTHORITY file
is, if the person sitting at the physical X session types "xhost
+localhost" then one should be able to attach x11vnc to the session
(from the same machine.) The person could then type "xhost -localhost"
after x11vnc has connected to go back to the default permissions.
Also, for some situations the "-users lurk=" option may soon be of use
(please read the documentation on the -users option.)
To test out your X11 permissions from a remote shell, set DISPLAY and
possibly XAUTHORITY (see your shell's man page, bash(1), tcsh(1), on
how to set environment variables) and type xdpyinfo in the same place
you will be typing (or otherwise running) x11vnc. If information is
printed out about the X display (screen sizes, supported extensions,
color visuals info) that means the X11 permissions are set up
properly: xdpyinfo successfully connected to DISPLAY! You could also
type xclock and make sure no errors are reported (a clock should
appear on the X display, press Ctrl-C to stop it.) If these work, then
typing "x11vnc" in the same environment should also work.
Important: if you cannot get your X11 permissions so that the xdpyinfo
or xclock tests work, x11vnc also will not work (all of these X
clients must be allowed to connect to the X server to function
properly.)
Firewalls: Speaking of permissions, it should go without saying that
the host-level firewall will need to be configured to allow
connections in on a port. E.g. 5900 (default VNC port) or 22 (default
SSH port for tunnelling VNC.) Most systems these days have firewalls
turned on by default, so you will actively have to do something to
poke a hole in the firewall at the desired port number. See your
system administration tool for Firewall settings (Yast, Firestarter,
etc.)
Q-2: I can't get x11vnc and/or libvncserver to compile.
Make sure you have gcc (or other C compiler) and all of the required
libraries and the corresponding -dev/-devel packages installed. These
include Xorg/XFree86, libX11, libjpeg, libz, libssl, ... and don't
forget the devs: libjpeg-dev, libssl-dev ...
The most common build problem that people encounter is that the
necessary X11 libraries are installed on their system however it does
not have the corresponding -dev/-devel packages installed. These dev
packages include C header files and build-time .so symlink. It is a
shame the current trend in distros is to not install the dev package
by default when the the library runtime package is installed... (it
diminishes the power of open source)
As of Nov/2006 here is a list of libraries that x11vnc usually likes
to use:
libc.so libX11.so libXtst.so libXext.so
libXfixes.so libXdamage.so libXinerama.so libXrandr.so
libz.so libjpeg.so libpthread.so
libssl.so libcrypto.so libcrypt.so
although x11vnc will be pretty usable with the subset: libc.so,
libX11.so, libXtst.so, libXext.so, libz.so, and libjpeg.so.
After running the libvncserver configure, carefully examine the output
and the messages in the config.log file looking for missing
components. For example, if the configure output looks like:
checking how to run the C preprocessor... gcc -E
checking for X... no
checking for XkbSelectEvents in -lX11... no
checking for XineramaQueryScreens in -lXinerama... no
checking for XTestFakeKeyEvent in -lXtst... no
or even worse:
checking for C compiler default output file name... configure: error:
C compiler cannot create executables
See `config.log' for more details.
there is quite a bit wrong with the build environment. Hopefully
simply adding -dev packages and/or gcc or make will fix it.
For Debian the list seems to be:
gcc
make
libc6-dev
libjpeg8-dev (formerly libjpeg62-dev)
libx11-dev
x11proto-core-dev (formerly x-dev)
libxext-dev
libxtst-dev
libxdamage-dev
libxfixes-dev
libxrandr-dev
libxinerama-dev
libxss-dev (formerly xlibs-static-dev)
zlib1g-dev
libssl-dev
libavahi-client-dev
linux-libc-dev (only needed for linux console rawfb support)
Note that depending on your OS version the above names may have been
changed and/or additional packages may be needed.
For Redhat the list seems to be:
gcc
make
glibc-devel
libjpeg-devel
libX11-devel
xorg-x11-proto-devel
libXdamage-devel
libXfixes-devel
libXrandr-devel
zlib-devel
openssl-devel
avahi-devel
kernel-headers (only needed for linux console rawfb support)
For other distros or OS's the package names may not be the same but
will look similar. Also, distros tend to rename packages as well so
the above list may be out of date. So only use the above lists as
hints for the package names that are needed.
Have a look at Misc. Build Problems for additional fixes.
Note: there is growing trend in Linux and other distros to slice up
core X11 software into more and smaller packages. So be prepared for
more headaches compiling software...
Q-3: I just built x11vnc successfully, but when I use it my keystrokes
and mouse button clicks are ignored (I am able to move the mouse
though.)
This is most likely due to you not having a working build environment
for the XTEST client library libXtst.so. The library is probably
present on your system, but the package installing the build header
file is missing.
If you were watching carefully while configure was running you would
have seen:
checking for XTestFakeKeyEvent in -lXtst... no
The solution is to add the necessary build environment package (and
the library package if that is missing too.) On Debian the build
package is libxtst-dev. Other distros/OS's may have it in another
package.
x11vnc will build without support for this library (e.g. perhaps one
wants a view-only x11vnc on a stripped down or embedded system...) And
at runtime it will also continue to run even if the X server it
connects to does not support XTEST. In both cases it cannot inject
keystrokes or button clicks since XTEST is needed for that (it can
still move the mouse pointer using the X API XWarpPointer().)
You will see a warning message something like this at run time:
20/03/2005 22:33:09 WARNING: XTEST extension not available (either missing fr
om
20/03/2005 22:33:09 display or client library libXtst missing at build time
.)
20/03/2005 22:33:09 MOST user input (pointer and keyboard) will be DISCARDE
D.
20/03/2005 22:33:09 If display does have XTEST, be sure to build x11vnc wit
h
20/03/2005 22:33:09 a working libXtst build environment (e.g. libxtst-dev,
20/03/2005 22:33:09 or other packages.)
20/03/2005 22:33:09 No XTEST extension, switching to -xwarppointer mode for
20/03/2005 22:33:09 pointer motion input.
Also, as of Nov/2006 there will be a configure build time warning as
well:
...
checking for XFixesGetCursorImage in -lXfixes... yes
checking for XDamageQueryExtension in -lXdamage... yes
configure: WARNING:
==========================================================================
A working build environment for the XTEST extension was not found (libXtst).
An x11vnc built this way will be only barely usable. You will be able to
move the mouse but not click or type. There can also be deadlocks if an
application grabs the X server.
It is recommended that you install the necessary development packages
for XTEST (perhaps it is named something like libxtst-dev) and run
configure again.
==========================================================================
Q-4: Help, I need to run x11vnc on Solaris 2.5.1 (or other old
Unix/Linux) and it doesn't compile!
We apologize that x11vnc does not build cleanly on older versions of
Solaris, Linux, etc.: very few users are on these old releases.
We have heard that since Dec/2004 a Solaris 2.6 built x11vnc will run
on Solaris Solaris 2.5 and 2.5.1 (since a workaround for XConvertCase
is provided.)
In any event, here is a workaround for Solaris 2.5.1 (and perhaps
earlier and perhaps non-Solaris):
First use the environment settings (CPPFLAGS, LDFLAGS, etc.) in the
above Solaris build script to run the configure command. That should
succeed without failure. Then you have to hand edit the autogenerated
rfb/rfbconfig.h file in the source tree, and just before the last
#endif at the bottom of that file insert these workaround lines:
struct timeval _tmp_usleep_tv;
#define usleep(x) \
_tmp_usleep_tv.tv_sec = (x) / 1000000; \
_tmp_usleep_tv.tv_usec = (x) % 1000000; \
select(0, NULL, NULL, NULL, &_tmp_usleep_tv);
int gethostname(char *name, int namelen);
long random();
int srandom(unsigned int seed);
#undef LIBVNCSERVER_HAVE_LIBPTHREAD
#define SHUT_RDWR 2
typedef unsigned int in_addr_t;
#define snprintf(a, n, args...) sprintf((a), ## args)
Then run make with the Solaris build script environment, everything
should compile without problems, and the resulting x11vnc binary
should work OK. If some non-x11vnc related programs fail (e.g. test
programs) and the x11vnc binary is not created try "make -k" to have
it keep going. Similar sorts of kludges in rfb/rfbconfig.h can be done
on other older OS (Solaris, Linux, ...) releases.
Here are some notes for similar steps that need to be done to build on
SunOS 4.x
Please let us know if you had to use the above workaround (and whether
it worked or not.) If there is enough demand we will try to push clean
compilations back to earlier Solaris, Linux, etc, releases.
Q-5: Where can I get a precompiled x11vnc binary for my Operating
System?
Hopefully the build steps above and FAQ provide enough info for a
painless compile for most environments. Please report problems with
the x11vnc configure, make, etc. on your system (if your system is
known to compile other GNU packages successfully.)
There are precompiled x11vnc binaries built by other groups that are
available at the following locations:
Slackware: (.tgz) http://www.linuxpackages.net/
SuSE: (.rpm) http:/software.opensuse.org/ Gentoo: (info)
http://gentoo-wiki.com/ and http://gentoo-portage.com/ FreeBSD: (.tbz)
http://www.freebsd.org/ http://www.freshports.org/net/x11vnc NetBSD:
(src) http://pkgsrc.se/x11/x11vnc OpenBSD: (.tgz) http://openports.se/
Arch Linux: (.tgz) http://www.archlinux.org/ Nokia 770 (.deb)
http://mike.saunby.googlepages.com/x11vncfornokia7702 Sharp Zaurus
http://www.focv.com/ Debian: (.deb) http://packages.debian.org/x11vnc
Redhat/Fedora: (.rpm) http://packages.sw.be/x11vnc RPMforge
http://dag.wieers.com/rpm/packages/x11vnc/ (N.B.: unmaintained after
0.9.3) Solaris: (pkg) http://www.sunfreeware.com/
If the above binaries don't work and building x11vnc on your OS fails
(and all else fails!) you can try one of My Collection of x11vnc
Binaries for various OS's and x11vnc releases.
As a general note, the x11vnc program is simple enough you don't
really need to install a package: the binary will in most cases work
as is and from any location (as long as your system libraries are not
too old, etc.) So, for Linux distributions that are not one of the
above, the x11vnc binary from the above packages has a good chance of
working. You can "install" it by just copying the x11vnc binary to the
desired directory in your PATH. Tip on extracting files from a Debian
package: extract the archive via a command like: "ar x
x11vnc_0.6-2_i386.deb" and then you can find the binary in the
resulting data.tar.gz tar file. Also, rpm2cpio(1) is useful in
extracting files from rpm packages.
If you use a standalone binary like this and also want x11vnc to serve
up the Java VNC Viewer jar file (either SSL enabled or regular one),
then you will need to extract the classes subdirectory from the source
tarball and point x11vnc to it via the -httpdir option. E.g.:
x11vnc -httpdir /path/to/x11vnc-0.9.9/classes/ssl ...
Alternatively, you can also go for a more up-to-date approach and use
the very decent noVNC viewer (https://kanaka.github.io/noVNC/) that is
purely HTML5 and does not need any plugins at all.
Q-6: Where can I get a VNC Viewer binary (or source code) for the
Operating System I will be viewing from?
To obtain VNC viewers for the viewing side (Windows, Mac OS, or Unix)
try here:
* http://www.tightvnc.com/download.html
* http://www.realvnc.com/download-free.html
* http://sourceforge.net/projects/cotvnc/
* http://www.ultravnc.com/
* Our Enhanced TightVNC Viewer (SSVNC)
[ssvnc.gif]
Q-7: How can I see all of x11vnc's command line options and
documentation on how to use them?
Run: x11vnc -opts to list just the option names or run: x11vnc
-help for long descriptions about each option. The output is listed
here as well. Yes, x11vnc does have a lot of options, doesn't it...
Q-8: I don't like typing arcane command line options every time I
start x11vnc. What can I do? Is there a config file? Or a GUI?
You could create a shell script that calls x11vnc with your options:
#!/bin/sh
#
# filename: X11vnc (i.e. not "x11vnc")
# It resides in a directory in $PATH. "chmod 755 X11vnc" has been run on it.
#
x11vnc -wait 50 -localhost -rfbauth $HOME/.vnc/passwd -display :0 $*
a similar thing can be done via aliases in your shell (bash, tcsh,
csh, etc..)
Or as of Jun/2004 you can use the simple $HOME/.x11vncrc config file
support. If that file exists, each line is taken as a command line
option. E.g. the above would be:
# this is a comment in my ~/.x11vncrc file
wait 50 # this is a comment to the end of the line.
-localhost # note: the leading "-" is optional.
rfbauth /home/fred/.vnc/passwd
display :0
As of Dec/2004 there is now a simple Tcl/Tk GUI based on the
remote-control functionality ("-R") that was added. The /usr/bin/wish
program is needed for operation. The gui is not particularly
user-friendly, it just provides a point and click mode to set all the
many x11vnc parameters and obtain help on them. It is also very useful
for testing. See the -gui option for more info. Examples: "x11vnc ...
-gui" and "x11vnc ... -gui other:0" in the latter case the gui is
displayed on other:0, not the X display x11vnc is polling. There is
also a "-gui tray" system tray mode.
[tkx11vnc.gif]
NOTE: You may need to install the "wish" or "tk" or "tk8.4" package
for the gui mode to work (the package name depends on your OS/distro.)
The tcl/tk "wish" interpreter is used. In debian (and so ubuntu too)
one would run "apt-get install tk" or perhaps "apt-get install tk8.4"
Q-9: How can I get the GUI to run in the System Tray, or at least be a
smaller, simpler icon?
As of Jul/2005 the gui can run in a more friendly small icon mode
"-gui icon" or in the system tray: "-gui tray". It has balloon status,
a simple menu, and a Properities dialog. The full, complicated, gui is
only available under "Advanced". Other improvements were added as
well. Try "Misc -> simple_gui" for a gui with fewer esoteric menu
items.
If the gui fails to embed itself in the system tray, do a retry via
"Window View -> icon" followed by "Window View -> tray" with the popup
menu.
For inexperienced users starting up x11vnc and the GUI while sitting
at the physical X display (not remotely), using something like "x11vnc
-display :0 -gui tray=setpass" might be something for them that they
are accustomed to in a Desktop environment (it prompts for an initial
password, etc.) This is a basic "Share My Desktop" usage mode.
As of Nov/2008 in x11vnc 0.9.6 there is a desktop menu item
(x11vnc.desktop) that runs this command:
x11vnc -gui tray=setpass -rfbport PROMPT -logfile %HOME/.x11vnc.log.%VNCDISP
LAY
which also prompts for which VNC port to use and a couple other
parameters.
Q-10: How can I get x11vnc to listen on a different port besides the
default VNC port (5900)?
Use something like, e.g., "x11vnc -rfbport 5901" to force it to use
port 5901 (this is VNC display :1.) If something else is using that
port x11vnc will exit immediately. If you do not supply the -rfbport
option, it will autoprobe starting at 5900 and work its way up to 5999
looking for a free port to listen on. In that case, watch for the
PORT=59xx line to see which port it found, then subtract 5900 from it
for the VNC display number to enter into the VNC Viewer(s).
The "-N" option will try to match the VNC display number to the X
display (e.g. X11 DISPLAY of :5 (port 6005) will have VNC display :5
(port 5905).)
Also see the "-autoport n" option to indicated at which value the auto
probing should start at.
Q-11: My Firewall/Router doesn't allow VNC Viewers to connect to
x11vnc.
See the Firewalls/Routers discussion.
Q-12: Is it possible for a VNC Viewer and a VNC Server to connect to
each other even though both are behind Firewalls that block all
incoming connections?
This is very difficult or impossible to do unless a third machine,
reachable by both, is used as a relay. So we assume a third machine is
somehow being used as a relay.
(Update: It may be possible to do "NAT-2-NAT" without a relay machine
by using a UDP tunnel such as http://samy.pl/pwnat/. All that is
required is that both NAT firewalls allow in UDP packets from an IP
address to which a UDP packet has recently been sent to. If you try it
out let us know how it went.)
In the following discussion, we will suppose port 5950 is being used
on the relay machine as the VNC port for the rendezvous.
A way to rendezvous is to have the VNC Server start a reverse
connection to the relay machine:
x11vnc -connect third-machine.net:5950 ...
and the VNC viewer forward connects as usual:
vncviewer third-machine.net:50
Or maybe two ports would be involved, e.g. the viewer goes to display
:51 (5951.) It depends on the relay software being used.
What software to run on third-machine? A TCP relay of some sort could
be used... Try a google search on "tcp relay" or "ip relay". However,
note that this isn't a simple redirection because it hooks up two
incoming connections. You can look at our UltraVNC repeater
implementation ultravnc_repeater.pl for ideas and possibly to
customize.
Also, if you are not the admin of third-machine you'd have to convince
the owner to allow you to install this software (and he would likely
need to open his server's firewall to allow the port through.)
It is recommended that SSL is used for encryption (e.g. "-ssl SAVE")
when going over the internet.
We have a prototype for performing a rendezvous via a Web Server
acting as the relay machine. Download the vncxfer CGI script and see
the instructions at the top.
Once that CGI script is set up on the website, both users go to, say,
http://somesite.com/vncxfer (or maybe a "/cgi-bin" directory or ".cgi"
suffix must be used.) Previously, both have agreed on the same session
name (say by phone or email) , e.g. "5cows", and put that into the
entry form on the vncxfer starting page (hopefully separated by a few
seconds, so the relay helper can fully start up at the first request.)
The page returned tells them the hostname and port number and possible
command to use for forward (VNC Viewer) and reverse (VNC Server, i.e.
x11vnc) connections as described above.
Also since Oct/2007, x11vnc can connect directly (no web browser),
like this:
x11vnc ... -connect localhost:0 -proxy 'http://somesite.com/vncxfer?session=
5cows&'
Unfortunately the prototype requires that the Web server's firewall
allow in the port (e.g. 5950) used for the rendezvous. Most web
servers are not configured to do this, so you would need to ask the
admin to do this for you. Nearly all free webspace sites, e.g.
www.zendurl.com, will not allow your CGI script to be an open relay
like this. (If you find one that does allow this, let me know!)
Maybe someday a clever trick will be thought up to relax the listening
port requirement (e.g. use HTTP/CGI itself for the transfer... it is
difficult to emulate a full-duplex TCP connection with them.)
See also the Firewalls/Routers discussion and Reverse Connection Proxy
discussion.
SSH method: If both users (i.e. one on Viewer-side and the other on
x11vnc server side) have SSH access to a common machine on the
internet (or otherwise mutually reachable), then SSH plumbing can be
used to solve this problem. The users create SSH tunnels going through
the SSH login machine.
Instead of assuming port 5900 is free on the SSH machine, we will
assume both users agreed to use 5933. This will illustrate how to use
a different port for the redir. It could be any port, what matters is
that both parties refer to the same one.
Set up the Tunnel from the VNC Server side:
ssh -t -R 5933:localhost:5900 user@third-machine.net
Set up the Tunnel from the VNC Viewer side:
ssh -t -L 5900:localhost:5933 user@third-machine.net
Run Server on the VNC Server side:
x11vnc -rfbport 5900 -localhost ...
Run Viewer on the VNC Viewer side:
vncviewer -encodings "copyrect tight zrle hextile" localhost:0
(we assume the old-style -encodings option needs to be used. See here
for details.)
If the SSH machine has been configured (see sshd_config(5)) with the
option GatewayPorts=yes, then the tunnel set up by the VNC Server will
be reachable directly by the VNC viewer (as long as the SSH machine's
firewall does not block the port, 5933 in this example.) So in that
case the Viewer side does not need to run any ssh command, but rather
only runs:
vncviewer third-machine.net:33
In this case we recommend SSL be used for encryption.
The creation of both tunnels can be automated. As of Oct/2007 the -ssh
x11vnc option is available and so only this command needs to be run on
the VNC Server side:
x11vnc -ssh user@third-machine.net:33 ...
(the SSH passphrase may need to be supplied.)
To automate on the VNC Viewer side, the user can use the Enhanced
TightVNC Viewer (SSVNC) by:
* Clicking on 'Use SSH'
* Entering user@third-machine.net:33 into 'VNC Host:Display' entry
box
* Clicking on 'Connect'
As above, if the SSH GatewayPorts=yes setting is configured the Viewer
side doesn't need to create a SSH tunnel. In SSVNC the Viewer user
could instead select 'Use SSL' and then, e.g., on the Server side
supply "-ssl SAVE" to x11vnc. Then end-to-end SSL encryption would be
used (in addition to the SSH encryption on the Server-side leg.)
Q-13: Can I make x11vnc more quiet and also go into the background
after starting up?
Use the -q and -bg options, respectively. (also: -quiet is an alias
for -q)
Note that under -bg the stderr messages will be lost unless you use
the "-o logfile" option.
Q-14: Sometimes when a VNC viewer dies abruptly, x11vnc also dies with
the error message like: "Broken pipe". I'm using the -forever mode and
I want x11vnc to keep running.
As of Jan/2004 the SIGPIPE signal is ignored. So if a viewer client
terminates abruptly, libvncserver will notice on the next I/O
operation and will close the connection and continue on.
Up until of Apr/2004 the above fix only works for BSD signal systems
(Linux, FreeBSD, ...) For SYSV systems there is a workaround in place
since about Jun/2004.
Q-15: The Windows TightVNC 1.3.9 Viewer cannot connect to x11vnc.
This appears to be fixed in x11vnc version 0.9 and later. If you need
to use an earlier version of x11vnc, try using the "-rfbversion 3.7"
option. In general sometimes one can get a misbehaving viewer to work
by supplying rfb versions 3.7 or 3.3.
Q-16: KDE's krdc VNC viewer cannot connect to x11vnc.
This has been fixed in x11vnc version 0.8.4. More info here, here, and
here.
Q-17: When I start x11vnc on an Alpha Tru64 workstation the X server
crashes!
This is a bug in the X server obviously; an X client should never be
able to crash it.
The problem seems to be with the RECORD X extension and so a
workaround is to use the "-noxrecord" x11vnc command line option.
Q-18: When running x11vnc on an IBM AIX workstation after a few
minutes the VNC connection freezes.
One user reports when running x11vnc on AIX 5.3 in his CDE session
after a few minutes or seconds x11vnc will "freeze" (no more updates
being sent, etc.) The freezing appeared to be worse for versions later
than 0.9.2.
The problem seems to be with the RECORD X extension on AIX and so a
workaround is to use the "-noxrecord" x11vnc command line option. The
user found no freezes occurred when using that option.
Q-19: Are there any build-time customizations possible, e.g. change
defaults, create a smaller binary, etc?
There are some options. They are enabled by adding something like
-Dxxxx=1 to the CPPFLAGS environment variable before running configure
(see the build notes for general background.)
/*
* Mar/2006
* Build-time customization via CPPFLAGS.
*
* Summary of options to include in CPPFLAGS for custom builds:
*
* -DVNCSHARED to have the vnc display shared by default.
* -DFOREVER to have -forever on by default.
* -DNOREPEAT=0 to have -repeat on by default.
* -DADDKEYSYMS=0 to have -noadd_keysyms the default.
*
* -DREMOTE_DEFAULT=0 to disable remote-control on by default (-yesremote.)
* -DREMOTE_CONTROL=0 to disable remote-control mechanism completely.
* -DEXTERNAL_COMMANDS=0 to disable the running of all external commands.
* -DFILEXFER=0 disable filexfer.
*
* -DHARDWIRE_PASSWD=... hardwired passwords, quoting necessary.
* -DHARDWIRE_VIEWPASSWD=...
* -DNOPW=1 make -nopw the default (skip warning)
* -DUSEPW=1 make -usepw the default
* -DPASSWD_REQUIRED=1 exit unless a password is supplied.
* -DPASSWD_UNLESS_NOPW=1 exit unless a password is supplied and no -nopw.
*
* -DWIREFRAME=0 to have -nowireframe as the default.
* -DWIREFRAME_COPYRECT=0 to have -nowirecopyrect as the default.
* -DWIREFRAME_PARMS=... set default -wirecopyrect parameters.
* -DSCROLL_COPYRECT=0 to have -noscrollcopyrect as the default.
* -DSCROLL_COPYRECT_PARMS=... set default -scrollcopyrect parameters.
* -DSCALING_COPYRECT=0
* -DXDAMAGE=0 to have -noxdamage as the default.
* -DSKIPDUPS=0 to have -noskip_dups as the default or vice versa.
*
* -DPOINTER_MODE_DEFAULT={0,1,2,3,4} set default -pointer_mode.
* -DBOLDLY_CLOSE_DISPLAY=0 to not close X DISPLAY under -rawfb.
* -DSMALL_FOOTPRINT=1 for smaller binary size (no help, no gui, etc)
* use 2 or 3 for even smaller footprint.
* -DNOGUI do not include the gui tkx11vnc.
* -DPOLL_8TO24_DELAY=N
* -DDEBUG_XEVENTS=1 enable printout for X events.
*
* Set these in CPPFLAGS before running configure. E.g.:
*
* % env CPPFLAGS="-DFOREVER -DREMOTE_CONTROL=0" ./configure
* % make
*/
If other things (e.g. "-I ...") are needed in CPPFLAGS add them as
well.
On some systems is seems you need to set LC_ALL=C for configure to
work properly...
Be careful the following two variables: HARDWIRE_PASSWD and
HARDWIRE_VIEWPASSWD. If set (remember to include the double quotes
around the string), they will be used as default values for the
-passwd and -viewpasswd options. Of course the strings will exist
unobscured in the x11vnc binary: it better not be readable by
unintendeds. Perhaps this is of use in remote access for an embedded
application, etc...
Let us know if more build-time customizations would be useful.
[Win2VNC Related]
Q-20: I have two separate machine displays in front of me, one Windows
the other X11: can I use x11vnc in combination with Win2VNC in
dual-screen mode to pass the keystrokes and mouse motions to the X11
display?
Yes, for best response start up x11vnc with the "-nofb" option
(disables framebuffer polling, and does other optimizations) on the
secondary display (X11) machine. Then start up Win2VNC on the primary
display (Windows) referring it to the secondary display.
This will also work X11 to X11 using x2vnc, however you would probably
just want to avoid VNC and use x2x for that.
For reference, here are some links to Win2VNC-like programs for
multiple monitor setups:
* Original Win2VNC
* Enhanced Win2VNC (broken?) and sourceforge link
* x2vnc
* x2x
* zvnc (MorphOS)
All of them will work with x11vnc (except x2x where it is not needed.)
Q-21: I am running Win2VNC on my Windows machine and "x11vnc -nofb" on
Unix to pass keyboard and mouse to the Unix monitor. Whenever I start
Win2VNC it quickly disconnects and x11vnc says:
rfbProcessClientNormalMessage: read: Connection reset by peer
Is the default visual of the X display you run x11vnc on low color
(e.g. 8 bit per pixel PseudoColor)? (you can run xdpyinfo to check,
look in the "screen" section.) There seems to be a bug in Win2VNC in
that it cannot deal correctly with colormaps (PseudoColor is the most
common example of a visual with a colormap.)
If so, there are a couple options. 1) Can you set the default visual
on your display to be depth 24 TrueColor? Sun machines often have 8+24
overlay/multi-depth visuals, and you can make the default visual depth
24 TrueColor (see fbconfig(1) and Xsun(1).) 2) As of Feb/2004 x11vnc
has the -visual option to allow you to force the framebuffer visual to
whatever you want (this usually messes up the colors unless you are
very clever.) In this case, the option provides a convenient
workaround for the Win2VNC bug:
x11vnc -nofb -visual TrueColor -display :0 ...
So the visual will be set to 8bpp TrueColor and Win2VNC can handle
this. Since Win2VNC does not use the framebuffer data there should be
no problems in doing this.
Q-22: Can I run "x11vnc -nofb" on a Mac OS X machine to redirect mouse
and keyboard input to it from Windows and X11 machines via Win2VNC and
x2vnc, respectively?
Yes, as of Nov/2006 you can. There may be a trick or two you'll need
to do to get the Clipboard exchange between the machines to work.
[Color Issues]
Q-23: The X display I run x11vnc on is only 8 bits per pixel (bpp)
PseudoColor (i.e. only 256 distinct colors.) The x11vnc colors may
start out OK, but after a while they are incorrect in certain windows.
Use the -flashcmap option to have x11vnc watch for changes in the
colormap, and propagate those changes back to connected clients. This
can be slow (since the whole screen must be updated over the network
whenever the colormap changes.) This flashing colormap behavior often
happens if an application installs its own private colormap when the
mouse is in its window. "netscape -install" is a well-known historical
example of this. Consider reconfiguring the system to 16 bpp or depth
24 TrueColor if at all possible.
Also note the option -8to24 (Jan/2006) can often remove the need for
flashing the colormap. Everything is dynamically transformed to depth
24 at 32 bpp using the colormaps. There may be painting errors however
(see the following FAQ for tips on reducing and correcting them.)
In some rare cases (SCO unixware) the -notruecolor option has
corrected colors on 8bpp displays. The red, green, and blue masks were
non-zero in 8bpp PseudoColor on an obscure setup, and this option
corrected the problems.
Q-24: Color problems: Why are the colors for some windows incorrect in
x11vnc? BTW, my X display has nice overlay/multi-depth visuals of
different color depths: e.g. there are both depth 8 and 24 visuals
available at the same time.
You may want to review the previous question regarding 8 bpp
PseudoColor.
On some hardware (Sun/SPARC and SGI), the -overlay option discussed a
couple paragraphs down may solve this for you (you may want to skip to
it directly.) On other hardware the less robust -8to24 option may help
(also discussed below.)
Run xdpyinfo(1) to see what the default visual is and what the depths
of the other visuals are. Does the default visual have a depth of 8
but there are other visuals of depth 24? If it does, can you possibly
re-configure your X server to make a depth 24 visual the default? If
you can do it, this will save you a lot of grief WRT colors and x11vnc
(and for general usage too!) Here is how I do this on an old
Sparcstation 20 running Solaris 9 with SX graphics
xinit -- -dev /dev/fb defclass TrueColor defdepth 24
and it works nicely (note: to log into console from the dtlogin
window, select "Options -> Command Line Login", then login and enter
the above command.) See the -dev section of the Xsun(1) manpage for a
description of the above arguments. If you have root permission, a
more permanent and convenient thing to do is to record the arguments
in a line like:
:0 Local local_uid@console root /usr/openwin/bin/Xsun -dev /dev/fb defclass
TrueColor defdepth 24
in /etc/dt/config/Xservers (copy /usr/dt/config/Xservers.) Also look
at the fbconfig(1) and related manpages (e.g. ffbconfig, m64config,
pgxconfig, SUNWjfb_config, etc ...) for hardware framebuffer settings
that may achieve the same effect.
In general for non-Sun machines, look at the "-cc class" and related
options in your X server manpage (perhaps Xserver(1)), it may allow
modifying the default visual (e.g. "-cc 4", see <X11/X.h> for the
visual class numbers.) On XFree86 some video card drivers (e.g. Matrox
mga) have settings like Option "Overlay" "24,8" to support multi-depth
overlays. For these, use the "-cc 4" X server command line option to
get a depth 24 default visual.
The -overlay mode: Another option is if the system with overlay
visuals is a Sun system running Solaris or SGI running IRIX you can
use the -overlay x11vnc option (Aug/2004) to have x11vnc use the
Solaris XReadScreen(3X11) function to poll the "true view" of the
whole screen at depth 24 TrueColor. XReadDisplay(3X11) is used on
IRIX. This is useful for Legacy applications (older versions of
Cadence CAD apps are mentioned by x11vnc users) that require the
default depth be 8bpp, or the app will use a 8bpp visual even if depth
24 visuals are available, and so the default depth workaround
described in the previous paragraph is not sufficient for these apps.
It seems that Xorg is working toward supporting XReadDisplay(3X11) as
part of the RENDER extension work. When it does support it and
provides a library API x11vnc will be modified to take advantage of
the feature to support -overlay on Linux, *BSD, etc. Until then see
the -8to24 mode below.
Misc. notes on -overlay mode: An amusing by-product of -overlay mode
is that the mouse cursor shape is correct! (i.e. XFIXES is not
needed.) The -overlay mode may be somewhat slower than normal mode due
to the extra framebuffer manipulations that must be performed. Also,
on Solaris there is a bug in that for some popup menus, the windows
they overlap will have painting errors (flashing colors) while the
popup is up (a workaround is to disable SaveUnders by passing -su to
Xsun, e.g. in your /etc/dt/config/Xservers file.)
The -8to24 mode: The -8to24 x11vnc option (Jan/2006) is a kludge to
try to dynamically rewrite the pixel values so that the 8bpp part of
the screen is mapped onto depth 24 TrueColor. This is less robust than
the -overlay mode because it is done by x11vnc outside of the X
server. So only use it on OS's that do not support -overlay. The
-8to24 mode will work if the default visual is depth 24 or depth 8. It
scans for any windows within 3 levels of the root window that are 8bpp
(i.e. legacy application), or in general ones that are not using the
default visual. For the windows it finds it uses XGetSubImage() to
retrieve the pixels values and uses the correct indexed colormap to
create a depth 24 TrueColor view of the whole screen. This depth 24,
32bpp view is exported via VNC.
Even on pure 8bpp displays it can be used as an alternative to
-flashcmap to avoid color flashing completely.
This scheme is approximate and can often lead to painting errors. You
can manually correct most painting errors by pressing 3 Alt_L's in a
row, or by using something like: -fixscreen V=3.0 to automatically
refresh the screen every 3 seconds. Also -fixscreen 8=3.0 has been
added to just refresh the non-default visual parts of the screen.
In general the scheme uses many resources and may give rise to
sluggish behavior. If multiple windows are using different 8bpp
indexed colormaps all but one window may need to be iconified for the
colors to be correct. There are a number of tunable parameters to try
to adjust performance and painting accuracy. The option -8to24
nogetimage can give a nice speedup if the default depth 24 X server
supports hiding the 8bpp bits in bits 25-32 of the framebuffer data.
On very slow machines -8to24 poll=0.2,cachewin=5.0 gives an useful
speedup. See the -8to24 help description for information on tunable
parameters, etc.
Colors still not working correctly? Run xwininfo on the application
with the incorrect colors to verify that the depth of its visual is
different from the default visual depth (gotten from xdpyinfo.) One
possible workaround in this case is to use the -id option to point
x11vnc at the application window itself. If the application is
complicated (lots of toplevel windows and popup menus) this may not be
acceptable, and may even crash x11vnc (but not the application.) See
also -appshare.
It is theoretically possible to solve this problem in general (see
xwd(1) for example), but it does not seem trivial or sufficiently fast
for x11vnc to be able to do so in real time. The -8to24 method does
this approximately and is somewhat usable. Fortunately the -overlay
option works for Solaris machines with overlay visuals where most of
this problem occurs.
Q-25: I am on a high color system (depth >= 24) but I seem to have
colormap problems. They either flash or everything is very dark.
This can happen if the default Visual (use xdpyinfo to list them) is
DirectColor instead of TrueColor. These are both usually used in high
color modes, but whereas TrueColor uses static ramps for the Red,
Green, and Blue components, DirectColor has arbitrary colormaps for
the Red, Green, and Blue Components. Currently x11vnc cannot decode
these colormaps and treats them just like TrueColor.
The only workaround so far is to restart the X server with the "-cc 4"
option to force TrueColor as the default visual (DirectColor is "-cc
5"; see /usr/include/X11/X.h.) The only place we have seen this is
with the virtual framebuffer server Xvfb on Xorg 7.2. So in that case
you probably should restart it with something like this: "Xvfb :1 -cc
4 -screen 0 1280x1024x24". It should be possible for x11vnc to handle
DirectColor, but this hasn't been implemented due to its rare usage.
You may also see this problem on an X display with a TrueColor default
visual where an application chooses a DirectColor visual for its
window(s). It seems the application also needs to install its own
colormap for the visual for the colors to be messed up in x11vnc. One
can make xwud do this for example.
Q-26: How do I figure out the window id to supply to the -id windowid
option?
Run the xwininfo program in a terminal. It will ask you to click on
the desired application window. After clicking, it will print out much
information, including the window id (e.g. 0x6000010.) Also, the
visual and depth of the window printed out is often useful in
debugging x11vnc color problems.
Also, as of Dec/2004 you can use "-id pick" to have x11vnc run
xwininfo(1) for you and after you click the window it extracts the
windowid. Besides "pick" there is also "id:root" to allow you to go
back to root window when doing remote-control.
Q-27: Why don't menus or other transient windows come up when I am
using the -id windowid option to view a single application window?
This is related to the behavior of the XGetImage(3X11) and
XShmGetImage() interfaces regarding backingstore, saveunders, etc. The
way the image is retrieved depends on some aspects of how the X server
maintains the display image data and whether other windows are
clipping or obscuring it. See the XGetImage(3X11) man page for more
details. If you disable BackingStore and SaveUnders in the X server
you should be able to see these transient windows.
If things are not working and you still want to do the single window
polling, try the -sid windowid option ("shifted" windowid.)
Update: as of Nov/2009 in the 0.9.9 x11vnc development tarball, there
is an experimental Application Sharing mode that improves upon the
-id/-sid single window sharing: -appshare (run "x11vnc -appshare
-help" for more info.) It is still very primitive and approximate, but
at least it displays multiple top-level windows.
Q-28: My X display is depth 24 at 24bpp (instead of the normal depth
24 at 32bpp.) I'm having lots of color and visual problems with x11vnc
and/or vncviewer. What's up?
First off, depth 24 at 24bpp (bpp=bits-per-pixel) is fairly uncommon
and can cause problems in general. It also can be slower than depth 24
at 32bpp. You might want to switch to 32bpp (for XFree86 see the
"-fbbpp 32", DefaultFbBpp, FbBpp and related options.) Perhaps you
have 24bpp because the video memory of the machine is low and the
screen wouldn't fit in video RAM at 32bpp. For this case depth 16 at
16bpp might be an acceptable option.
In any event x11vnc should handle depth 24 at 24bpp (although
performance may be slower, and you may need to use the ZRLE encoding
instead of Tight.) There are some caveats involving the viewer
however:
The RealVNC Unix viewer cannot handle 24bpp from the server, it will
say: "main: setPF: not 8, 16 or 32 bpp?" and exit. I have not checked
the RealVNC Windows viewer.
So you need to use the TightVNC Unix viewer. However there are some
problems with that too. It seems libvncserver does not do 24bpp
correctly with the Tight encoding. The colors and screen ultimately
get messed up. So you have to use a different encoding with the
TightVNC vncviewer, try "zlib", "hextile", or one of the other
encodings (e.g. vncviewer -encodings "zlib hextile" ....) I have not
checked the TightVNC or UltraVNC Windows viewers.
It appears the older RealVNC Unix viewers (e.g. 3.3.3 and 3.3.7) can
handle 24bpp from the server, so you may want to use those. They
evidently request 32 bpp and libvncserver obliges.
Update: as of Apr/2006 you can use the -24to32 option to have x11vnc
dynamically transform the 24bpp pixel data to 32bpp. This extra
transformation could slow things down further however.
Now coming the opposite direction if you are running the vncviewer on
the 24bpp display, TightVNC will fail with "Can't cope with 24
bits-per-pixel. Sorry." and RealVNC will fail with "main: Error:
couldn't find suitable pixmap format" so evidently you cannot use
24bpp for the vncviewers to work on that X display.
Note, however, that the Unix viewer in the Enhanced TightVNC Viewer
(SSVNC) project can handle 24bpp X displays. It does this by
requesting a 16bpp pixel format (or 8bpp if the -bgr233 option has
been supplied) from the VNC server, and translates that to 24bpp
locally.
[Xterminals]
Q-29: Can I use x11vnc to view and interact with an Xterminal (e.g.
NCD) that is not running UNIX and so x11vnc cannot be run on it
directly?
You can, but it will likely be very wasteful of network bandwidth
since you will be polling the X display over the network as opposed to
over the local hardware. To do this, run x11vnc on a UNIX machine as
close as possible network-wise (e.g. same switch) to the Xterminal
machine. Use the -display option to point the display to that of the
Xterminal (you'll of course need basic X11 permission to do that) and
finally supply the -noshm option (this enables the polling over the
network.)
If the Xterminal's X display is open to the network for connections,
you might use something like "-display xterm123:0". If you are trying
to do this via an SSH tunnel (assuming you can actually ssh into the
Xterminal) it will be a little tricky (either use the ssh "-R" option
or consider ssh-ing in the other direction.) In all cases the X11
permissions need to allow the connection.
The response will likely be sluggish (maybe only one "frame" per
second.) This mode is not recommended except for "quick checks" of
hard to get to X servers. Use something like "-wait 150" to cut down
on the polling rate. You may also need -flipbyteorder if the colors
get messed up due to endian byte order differences.
Q-30: How do I get my X permissions (MIT-MAGIC-COOKIE file) correct
for a Unix/Linux machine acting as an Xterminal?
If the X display machine is a traditional Xterminal (where the X
server process runs on the Xterminal box, but all of the X client
applications (firefox, etc) run on a central server (aka "terminal
server")), you will need to log into the Xterminal machine (i.e. get a
shell running there) and then start the x11vnc program. If the
Xterminal Linux/Unix machine is stripped down (e.g. no users besides
root) that may be difficult.
The next problem is the login Display Manager (e.g. gdm, kdm), and
hence the MIT-MAGIC-COOKIE auth files, are on the central server and
not on the Xterminal box where the X server and x11vnc processes are.
So unless X permissions are completely turned off (e.g. "xhost +"), to
run the x11vnc process on the Xterminal box the MIT-MAGIC-COOKIE auth
file data (XAUTHORITY or $HOME/.Xauthority) must be accessible by or
copied to the Xterminal. If $HOME/.Xauthority is exported via NFS
(this is insecure of course, but has been going on for decades), then
x11vnc can simply pick it up via NFS (you may need to use the -auth
option to point to the correct file.) Other options include copying
the auth file using scp, or something like:
central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge -
and then, say, ssh from central-server to xterm123 to start x11vnc.
Here "xterm123" refers to the computer acting as the Xterminal and
"central-server" is the terminal server. You can use "xauth -f
/path/to/cookie-file list" to examine the contents of the cookie(s) in
a file "/path/to/cookie-file". See the xauth(1) manpage for more
details.
If the display name in the cookie file needs to be changed between the
two hosts, see this note on the "xauth add ..." command.
A less secure option is to run something like "xhost +127.0.0.1" while
sitting at the Xterminal box to allow cookie-free local access for
x11vnc. You can run "xhost -127.0.0.1" after x11vnc connects if you
want to go back to the original permissions.
If the Xterminal is really stripped down and doesn't have any user
accounts, NFS, etc. you'll need to contact your system administrator
to set something up. It can be done!!! Some Xterminal projects have
actually enabled "run locally" facilities for the running of an
occasional app more efficiently locally on the Xterminal box (e.g.
realplayer.)
Not recommended, but as a last resort, you could have x11vnc poll the
Xterminal Display over the network. For this you would run a "x11vnc
-noshm ..." process on the central-server (and hope the network admin
doesn't get angry...)
Note: use of Display Manager (gdm, kdm, ...) auth cookie files (i.e.
from /var/..., /tmp/..., or elsewhere) may require modification via
xauth(1) to correctly include the display x11vnc refers to (e.g.
"xauth -f cookie-file add :0 . 45be51ae2ce9dfbacd882ab3ef8e96b1",
where the "45be51..." cookie value was found from an "xauth -f
/path/to/original/cookie-file list") or other reasons. See xauth(1)
manpage for full details on how to transfer an MIT-MAGIC-COOKIE
between machines and displays.
VNCviewer performance on Xterminals: This isn't related to x11vnc on
Xterminals, but we mention it here anyway because of the similar
issues. If you are on an Xterminal and want to use vncviewer to
connect to a VNC server somewhere, then performance would be best if
you ran the viewer on the Xterminal box. Otherwise, (i.e. running the
viewer process on the central-server) all of the vncviewer screen
drawing is done more inefficiently over the network. Something to
consider, especially on a busy network. (BTW, this has all of the
above permission, etc, problems: both vncviewer and x11vnc are X
client apps desired to be run on the Xterminal box.)
[Sun Rays]
Q-31: I'm having trouble using x11vnc with my Sun Ray session.
The Sun Ray technology is a bit like "VNC done in hardware" (the Sun
Ray terminal device, DTU, playing the role of the vncviewer.)
Completely independent of that, the SunRay user's session is still an
X server that speaks the X11 protocol and so x11vnc simply talks to
the X server part to export the SunRay desktop to any place in the
world (i.e. not only to a Sun Ray terminal device), creating a sort of
"Soft Ray". Please see this discussion of Sun Ray issues for solutions
to problems.
Also see the Sun Ray Remote Control Toolkit that uses x11vnc.
[Remote Control]
Q-32: How do I stop x11vnc once it is running in the background?
As of Dec/2004 there is a remote control feature. It can change a huge
number of parameters on the fly: see the -remote and -query options.
To shut down the running x11vnc server just type "x11vnc -R stop". To
disconnect all clients do "x11vnc -R disconnect:all", etc.
If the -forever option has not been supplied, x11vnc will
automatically exit after the first client disconnects. In general if
you cannot use the remote control, then you will have to kill the
x11vnc process This can be done via: "kill NNNNN" (where NNNNN is the
x11vnc process id number found from ps(1)), or "pkill x11vnc", or
"killall x11vnc" (Linux only.)
If you have not put x11vnc in the background via the -bg option or
shell & operator, then simply press Ctrl-C in the shell where x11vnc
is running to stop it.
Potential Gotcha: If somehow your Keypress of Ctrl-C went through
x11vnc to the Xserver that then delivered it to x11vnc it is possible
one or both of the Ctrl or C keys will be left stuck in the pressed
down state in the Xserver. Tapping the stuck key (either via a new
x11vnc or at the physical console) will release it from the stuck
state. If the keyboard seems to be acting strangely it is often fixed
by tapping Ctrl, Shift, and Alt. Alternatively, the -clear_mods option
and -clear_keys option can be used to release pressed keys at startup
and exit. The option -clear_all will also try to unset Caps_Lock,
Num_Lock, etc.
Q-33: Can I change settings in x11vnc without having to restart it?
Can I remote control it?
Look at the -remote (an alias is -R) and -query (an alias is -Q)
options added in Dec/2004. They allow nearly everything to be changed
dynamically and settings to be queried. Examples: "x11vnc -R shared",
"x11vnc -R forever", "x11vnc -R scale:3/4", "x11vnc -Q modtweak",
"x11vnc -R stop", "x11vnc -R disconnect:all", etc..
These commands do not start a x11vnc server, but rather communicate
with one that is already running. The X display (X11VNC_REMOTE
property) is used as the communication channel, so the X permissions
and DISPLAY must be set up correctly for communication to be possible.
There is also a simple Tcl/Tk gui based on this remote control
mechanism. See the -gui option for more info. You will need to have
Tcl/Tk (i.e. /usr/bin/wish) installed for it to work. It can also run
in the system tray: "-gui tray" or as a standalone small icon window:
"-gui icon". Use "-gui tray=setpass" for a naive user "Share My
Desktop" mode.
[Security and Permissions]
Q-34: How do I create a VNC password for use with x11vnc?
You may already have one in $HOME/.vnc/passwd if you have used, say,
the vncserver program from the regular RealVNC or TightVNC packages
(i.e. launching the Xvnc server.) Otherwise, you could use the
vncpasswd(1) program from those packages.
As of Jun/2004 x11vnc supports the -storepasswd "pass" "file" option,
which is the same functionality of storepasswd. Be sure to quote the
"pass" if it contains shell meta characters, spaces, etc. Example:
x11vnc -storepasswd 'sword*fish' $HOME/myvncpasswd
You then use the password via the x11vnc option: "-rfbauth
$HOME/myvncpasswd"
As of Jan/2006 if you do not supply any arguments:
x11vnc -storepasswd
you will be prompted for a password to save to ~/.vnc/passwd (your
keystrokes when entering the password will not be echoed to the
screen.) If you supply one argument, e.g. "x11vnc -storepasswd
~/.mypass", the password you are prompted for will be stored in that
file.
x11vnc also has the -passwdfile and -passwd/-viewpasswd plain text
(i.e. not obscured like the -rfbauth VNC passwords) password options.
You can use the -usepw option to automatically use any password file
you have in ~/.vnc/passwd or ~/.vnc/passwdfile (the latter is used
with the -passwdfile option.)
x11vnc -usepw -display :0 ...
If neither file exists you are prompted to store a password in
~/.vnc/passwd. If a password file cannot be found or created x11vnc
exits immediately. An admin may want to set it up this way for users
who do not know better.
Q-35: Can I make it so -storepasswd doesn't show my password on the
screen?
You can use the vncpasswd program from RealVNC or TightVNC mentioned
above. As of Jan/2006 the -storepasswd option without any arguments
will not echo your password as you type it and save the file to
~/.vnc/passwd:
# x11vnc -storepasswd
Enter VNC password:
Verify password:
Write password to /home/myname/.vnc/passwd? [y]/n
Password written to: /home/myname/.vnc/passwd
You can also give it an alternate filename, e.g. "x11vnc -storepasswd
~/.mypass"
Q-36: Can I have two passwords for VNC viewers, one for full access
and the other for view-only access to the display?
Yes, as of May/2004 there is the -viewpasswd option to supply the
view-only password. Note the full-access password option -passwd must
be supplied at the same time. E.g.: -passwd sword -viewpasswd fish.
To avoid specifying the passwords on the command line (where they
could be observed via the ps(1) command by any user) you can use the
-passwdfile option to specify a file containing plain text passwords.
Presumably this file is readable only by you, and ideally it is
located on the machine x11vnc is run on (to avoid being snooped on
over the network.) The first line of this file is the full-access
password. If there is a second line in the file and it is non-blank,
it is taken as the view-only password. (use "__EMPTY__" to supply an
empty one.)
View-only passwords currently do not work for the -rfbauth password
option (standard VNC password storing mechanism.) FWIW, note that
although the output (usually placed in $HOME/.vnc/passwd) by the
vncpasswd or storepasswd programs (or from x11vnc -storepasswd) looks
encrypted they are really just obscured to avoid "casual" password
stealing. It takes almost no skill to figure out how to extract the
plain text passwords from $HOME/.vnc/passwd since it is very
straight-forward to work out what to do from the VNC source code.
Q-37: Can I have as many full-access and view-only passwords as I
like?
Yes, as of Jan/2006 in the libvncserver CVS the -passwdfile option has
been extended to handle as many passwords as you like. You put the
view-only passwords after a line __BEGIN_VIEWONLY__.
You can also easily annotate and comment out passwords in the file.
You can have x11vnc re-read the file dynamically when it is modified.
Q-38: Does x11vnc support Unix usernames and passwords? Can I further
limit the set of Unix usernames who can connect to the VNC desktop?
Update: as of Feb/2006 x11vnc has the -unixpw option that does this
outside of the VNC protocol and libvncserver. The standard su(1)
program is used to validate the user's password. A familiar "login:"
and "Password:" dialog is presented to the user on a black screen
inside the vncviewer. The connection is dropped if the user fails to
supply the correct password in 3 tries or does not send one before a
25 second timeout. Existing clients are view-only during this period.
A list of allowed Unix usernames may also be supplied along with
per-user settings.
There is also the -unixpw_nis option for non-shadow-password
(typically NIS environments, hence the name) systems where the
traditional getpwnam() and crypt() functions are used instead of
su(1). The encrypted user passwords must be accessible to the user
running x11vnc in -unixpw_nis mode, otherwise the logins will always
fail even when the correct password is supplied. See ypcat(1) and
shadow(5).
Two settings are enforced in the -unixpw and -unixpw_nis modes to
provide extra security: the 1) -localhost and 2) -stunnel or -ssl
options. Without these one might send the Unix username and password
data in clear text over the network which is a very bad idea. They can
be relaxed if you want to provide encryption other than stunnel or
-ssl (the constraint is automatically relaxed if SSH_CONNECTION is set
and indicates you have ssh-ed in, however the -localhost requirement
is still enforced.)
The two -unixpw modes have been tested on Linux, Solaris, Mac OS X,
HP-UX, AIX, Tru64, FreeBSD, OpenBSD, and NetBSD. Additional testing is
appreciated. For the last 4 it appears that su(1) will not prompt for
a password if su-ing to oneself. Since x11vnc requires a password
prompt from su, x11vnc forces those logins to fail even when the
correct password is supplied. On *BSD it appears this can be corrected
by removing the pam_self.so entry in /etc/pam.d/su.
Previous older discussion (prior to the -unixpw option):
Until the VNC protocol and libvncserver support this things will be
approximate at best.
One approximate method involves starting x11vnc with the -localhost
option. This basically requires the viewer user to log into the
workstation where x11vnc is running via their Unix username and
password, and then somehow set up a port redirection of his vncviewer
connection to make it appear to emanate from the local machine. As
discussed above, ssh is useful for this: "ssh -L 5900:localhost:5900
user@hostname ..." See the ssh wrapper scripts mentioned elsewhere on
this page. stunnel does this as well.
Of course a malicious user could allow other users to get in through
his channel, but that is a problem with every method. Another thing to
watch out for is a malicious user on the viewer side (where ssh is
running) trying to sneak in through the ssh port redirection there.
Regarding limiting the set of Unix usernames who can connect, the
traditional way would be to further require a VNC password to supplied
(-rfbauth, -passwd, etc) and only tell the people allowed in what the
VNC password is. A scheme that avoids a second password involves using
the -accept option that runs a program to examine the connection
information to determine which user is connecting from the local
machine. That may be difficult to do, but, for example, the program
could use the ident service on the local machine (normally ident
should not be trusted over the network, but on the local machine it
should be accurate: otherwise root has been compromised and so there
are more serious problems! Unfortunately recent Linux distros seem to
provide a random string (MD5 hash?) instead of the username.) An
example script passed in via -accept scriptname that deduces the Unix
username and limits who can be accepted might look something like
this:
#!/bin/sh
if [ "$RFB_CLIENT_IP" != "127.0.0.1" -o "$RFB_SERVER_IP" != "127.0.0.1" ]; then
exit 1 # something fishy... reject it.
fi
user=`echo "$RFB_CLIENT_PORT, $RFB_SERVER_PORT" | nc -w 1 $RFB_CLIENT_IP 113 \
| grep 'USERID.*UNIX' | head -n 1 | sed -e 's/[\r ]//g' | awk -F: '{pri
nt $4}'`
for okuser in fred barney wilma betty
do
if [ "X$user" = "X$okuser" ]; then
exit 0 # accept it
fi
done
exit 1 # reject it
For this to work with ssh port redirection, the ssh option
UsePrivilegeSeparation must be enabled otherwise the userid will
always be "root".
Here is a similar example based on Linux netstat(1) output:
#!/bin/sh
#
# accept_local_netstat: x11vnc -accept command to accept a local
# vncviewer connection from acceptable users. Linux netstat -nte is used.
PATH=/bin:/usr/bin:$PATH; export PATH; # set to get system utils
allowed="`id -u fred`"; # add more user numbers if desired.
# check required settings
ok=1
if [ "X$allowed" = "X" ]; then
ok=0; # something wrong with allowed list
fi
if [ "X$RFB_CLIENT_IP" != "X127.0.0.1" -o "X$RFB_SERVER_IP" != "X127.0.0.1" ];
then
ok=0; # connection not over localhost
fi
if [ "$RFB_CLIENT_PORT" -le 0 -o "$RFB_SERVER_PORT" -le 0 ]; then
ok=0; # something wrong with tcp port numbers
fi
if [ "$ok" = 0 ]; then
echo "$0: invalid setting:" 1>&2
env | grep ^RFB | sort 1>&2
exit 1
fi
# Linux netstat -nte:
# Proto Recv-Q Send-Q Local Address Foreign Address State
User Inode
# 0 0 0 RFB_CLIENT RFB_SERVER ESTABLISHED
nnnn ....
#
user=`netstat -nte | grep ESTABLISHED \
| grep " $RFB_CLIENT_IP:$RFB_CLIENT_PORT *$RFB_SERVER_IP:$RFB_SERVER_P
ORT "`
echo "netstat match: $user" 1>&2
user=`echo "$user" | head -n 1 | sed -e 's/^.*ESTABLISHED/ /' | awk '{print $1}
'`
ok=0
for u in $allowed
do
if [ "X$user" = "X$u" ]; then
ok=1
break
fi
done
if [ "X$ok" = "X1" ]; then
echo "$0: user accepted: '$user'" 1>&2
exit 0
else
echo "$0: user '$user' invalid:" 1>&2
echo "$0: allowed: $allowed" 1>&2
env | grep ^RFB | sort 1>&2
exit 1
fi
Q-39: Can I supply an external program to provide my own custom login
method (e.g. Dynamic/One-time passwords or non-Unix (LDAP) usernames
and passwords)?
Yes, there are several possibilities. For background see the FAQ on
the -accept where an external program may be run to decide if a VNC
client should be allowed to try to connect and log in. If the program
(or local user prompted by a popup) answers "yes", then -accept
proceeds to the normal VNC and x11vnc authentication methods,
otherwise the connection is dropped.
To provide more direct coupling to the VNC client's username and/or
supplied password the following options were added in Sep/2006:
* -unixpw_cmd command
* -passwdfile cmd:command
* -passwdfile custom:command
In each case "command" is an external command run by x11vnc. You
supply it. For example, it may couple to your LDAP system or other
servers you set up.
For -unixpw_cmd the normal -unixpw Login: and Password: prompts are
supplied to the VNC viewer and the strings the client returns are then
piped into "command" as the first two lines of its standard input. If
the command returns success, i.e. exit(0), the VNC client is accepted,
otherwise it is rejected.
For "-passwdfile cmd:command" the command is run and it returns a
password list (like a password file, see the -passwdfile read:filename
mode.) Perhaps a dynamic, one-time password is retrieved from a server
this way.
For "-passwdfile custom:command" one gets complete control over the
VNC challenge-response dialog with the VNC client. x11vnc sends out a
string of random bytes (16 by the VNC spec) and the client returns the
same number of bytes in a way the server can verify only the
authorized user could have created. The VNC protocol specifies DES
encryption with a password. If you are willing to modify the VNC
viewers, you can have it be anything you want, perhaps a less
crackable MD5 hash scheme or one-time pad. Your program will read from
its standard input the size of the challenge-response followed by a
newline, then the challenge bytes followed by the response bytes. If
your command then returns success, i.e. exit(0), the VNC client is
accepted, otherwise it is rejected.
In all cases the "RFB_*" environment variables are set as under
-accept. These variables can provide useful information for the
externally supplied program to use.
Q-40: Why does x11vnc exit as soon as the VNC viewer disconnects? And
why doesn't it allow more than one VNC viewer to connect at the same
time?
These defaults are simple safety measures to avoid someone unknowingly
leaving his X11 desktop exposed (to the internet, say) for long
periods of time. Use the -forever option (aka -many) to have x11vnc
wait for more connections after the first client disconnects. Use the
-shared option to have x11vnc allow multiple clients to connect
simultaneously.
Recommended additional safety measures include using ssh (see above),
stunnel, -ssl, or a VPN to authenticate and encrypt the viewer
connections or to at least use the -rfbauth passwd-file option to use
VNC password protection (or -passwdfile) It is up to YOU to apply
these security measures, they will not be done for you automatically.
Q-41: Can I limit which machines incoming VNC clients can connect
from?
Yes, look at the -allow and -localhost options to limit connections by
hostname or IP address. E.g.
x11vnc -allow 192.168.0.1,192.168.0.2
for those two hosts or
x11vnc -allow 192.168.0.
for a subnet. For individual hosts you can use the hostname instead of
the IP number, e.g.: "-allow snoopy", and "-allow darkstar,wombat".
Note that -localhost achieves the same thing as "-allow 127.0.0.1"
For more control, build libvncserver with libwrap support
(tcp_wrappers) and then use /etc/hosts.allow See hosts_access(5) for
complete details.
Q-42: How do I build x11vnc/libvncserver with libwrap (tcp_wrappers)
support?
Here is one way to pass this information to the configure script:
env CPPFLAGS=-DUSE_LIBWRAP LDFLAGS=-lwrap ./configure
then run make as usual. This requires libwrap and its development
package (tcpd.h) to be installed on the build machine. If additional
CPPFLAGS or LDFLAGS options are needed supply them as well using
quotes.
The resulting x11vnc then uses libwrap/tcp_wrappers for connections.
The service name you will use in /etc/hosts.allow and /etc/hosts.deny
is "vnc", e.g.:
vnc: 192.168.100.3 .example.com
Note that if you run x11vnc out of inetd you do not need to build
x11vnc with libwrap support because the /usr/sbin/tcpd reference in
/etc/inetd.conf handles the tcp_wrappers stuff.
Q-43: Can I have x11vnc only listen on one network interface (e.g.
internal LAN) rather than having it listen on all network interfaces
and relying on -allow to filter unwanted connections out?
As of Mar/2005 there is the "-listen ipaddr" option that enables this.
For ipaddr either supply the desired network interface's IP address
(or use a hostname that resolves to it) or use the string "localhost".
For additional filtering simultaneously use the "-allow host1,..."
option to allow only specific hosts in.
This option is useful if you want to insure that no one can even begin
a dialog with x11vnc from untrusted network interfaces (e.g. ppp0.)
The option -localhost now implies "-listen localhost" since that is
what most people expect it to do.
Q-44: Now that -localhost implies listening only on the loopback
interface, how I can occasionally allow in a non-localhost via the -R
allowonce remote control command?
To do this specify "-allow localhost". Unlike -localhost this will
leave x11vnc listening on all interfaces (but of course only allowing
in local connections, e.g. ssh redirs.) Then you can later run "x11vnc
-R allowonce:somehost" or use to gui to permit a one-shot connection
from a remote host.
Q-45: Can I fine tune what types of user input are allowed? E.g. have
some users just be able to move the mouse, but not click or type
anything?
As of Feb/2005, the -input option allows you to do this. "K", "M",
"B", "C", and "F" stand for Keystroke, Mouse-motion, Button-clicks,
Clipboard, and File-Transfer, respectively. The setting: "-input M"
makes attached viewers only able to move the mouse. "-input KMBC,M"
lets normal clients do everything and enables view-only clients to
move the mouse.
These settings can also be applied on a per-viewer basis via the
remote control mechanism or the GUI. E.g. x11vnc -R input:hostname:M
Q-46: Can I prompt the user at the local X display whether the
incoming VNC client should be accepted or not? Can I decide to make
some clients view-only? How about running an arbitrary program to make
the decisions?
Yes, look at the "-accept command" option, it allows you to specify an
external command that is run for each new client. (use quotes around
the command if it contains spaces, etc.) If the external command
returns 0 (success) the client is accepted, otherwise with any other
return code the client is rejected. See below how to also accept
clients view-only.
The external command will have the RFB_CLIENT_IP environment variable
set to the client's numerical IP address, RFB_CLIENT_PORT its port
number. Similarly for RFB_SERVER_IP and RFB_SERVER_PORT to allow
identification of the tcp virtual circuit. DISPLAY will be set to that
of the X11 display being polled. Also, RFB_X11VNC_PID is set to the
x11vnc process id (e.g. in case you decided to kill it), RFB_CLIENT_ID
will be an id number, and RFB_CLIENT_COUNT the number of other clients
currently connected. RFB_MODE will be "accept".
Built-in Popup Window: As a special case, "-accept popup" will
instruct x11vnc to create its own simple popup window. To accept the
client press "y" or click mouse on the "Yes" button. To reject the
client press "n" or click mouse on the "No" button. To accept the
client View-only, press "v" or click mouse on the "View" button. If
the -viewonly option has been supplied, the "View" action will not be
present: the whole display is view only in that case.
The popup window times out after 120 seconds, to change this behavior
use "-accept popup:N" where N is the number of seconds (use 0 for no
timeout.) More tricks: "-accept popupmouse" will only take mouse click
responses, while "-accept popupkey" will only take keystroke responses
(popup takes both.) After any of the 3 popup keywords you can supply a
position of the window: +N+M, (the default is to center the window)
e.g. -accept popupmouse+10+10.
Also as a special case "-accept xmessage" will run the xmessage(1)
program to prompt the user whether the client should be accepted or
not. This requires that you have xmessage installed and available via
PATH. In case it is not already on your system, the xmessage program
is available at ftp://ftp.x.org/
(End of Built-in Popup Window:)
To include view-only decisions for the external commands, prefix the
command something like this: "yes:0,no:*,view:3 mycommand ..." This
associates the three actions: yes(accept), no(reject), and
view(accept-view-only), with the numerical return (i.e. exit()) codes.
Use "*" instead of a number to set the default action (e.g. in case
the external command returns an unexpected return code.)
Here is an example -accept script called accept_or_lock. It uses
xmessage and xlock (replace with your screen lock command, maybe it is
"xscreensaver-command -lock", or kdesktop_lock, or "dtaction
LockDisplay".) It will prompt the user at the X display whether to
accept, reject, or accept view-only the client, but if the prompt
times out after 60 seconds the screen is locked and the VNC client is
accepted. This allows the remote access when no one is at the display.
#!/bin/sh
#
# accept_or_lock: prompt user at X display whether to accept an incoming
# VNC connection. If timeout expires, screen is locked
# and the VNC viewer is accepted (allows remote access
# when no one is sitting at the display.)
#
# usage: x11vnc ... -forever -accept 'yes:0,no:*,view:4 accept_or_lock'
#
xmessage -buttons yes:2,no:3,view-only:4 -center \
-timeout 60 "x11vnc: accept connection from $RFB_CLIENT_IP?"
rc=$?
if [ $rc = 0 ]; then
xlock & # or "xlock -mode blank" for no animations.
sleep 5
exit 0
elif [ $rc = 2 ]; then
exit 0
elif [ $rc = 4 ]; then
exit 4
fi
exit 1
Stefan Radman has written a nice dtksh script dtVncPopup for use in
CDE environments to do the same sort of thing. Information on how to
use it is found at the top of the file. He encourages you to provide
feedback to him to help improve the script.
Note that in all cases x11vnc will block while the external command or
popup is being run, so attached clients will not receive screen
updates, etc during this period.
To run a command when a client disconnects, use the "-gone command"
option. This is for the user's convenience only: the return code of
the command is not interpreted by x11vnc. The same environment
variables are set as in "-accept command" (except that RFB_MODE will
be "gone".)
As of Jan/2006 the "-afteraccept command" option will run the command
only after the VNC client has been accepted and authenticated. Like
-gone the return code is not interpreted. RFB_MODE will be
"afteraccept".)
Q-47: I start x11vnc as root because it is launched via inetd(8) or a
display manager like gdm(1). Can I have x11vnc later switch to a
different user?
As of Feb/2005 x11vnc has the -users option that allows things like
this. Please read the documentation on it (also in the x11vnc -help
output) carefully for features and caveats. It's use can often
decrease security unless care is taken.
BTW, a nice use of it is "-users +nobody" that switches to the Unix
user nobody right after connections to the X display are established.
In any event, while running x11vnc as root, remember it comes with no
warranty ;-).
Q-48: I use a screen-lock when I leave my workstation (e.g.
xscreensaver or xlock.) When I remotely access my workstation desktop
via x11vnc I can unlock the desktop fine, but I am worried people will
see my activities on the physical monitor. What can I do to prevent
this, or at least make it more difficult?
Probably most work environments would respect your privacy if you
powered off the monitor. Also remember if people have physical access
to your workstation they basically can do anything they want with it
(e.g. install a backdoor for later use, etc.)
In any event, as of Jun/2004 there is an experimental utility to make
it more difficult for nosey people to see your x11vnc activities. The
source for it is blockdpy.c The idea behind it is simple (but
obviously not bulletproof): when a VNC client attaches to x11vnc put
the display monitor in the DPMS "off" state, if the DPMS state ever
changes immediately start up the screen-lock program. The x11vnc user
will notice something is happening and think about what to do next
(while the screen is in a locked state.)
This works (or at least has a chance of working) because if the
intruder moves the mouse or presses a key on the keyboard, the monitor
wakes up out of the DPMS off state, and this induces the screen lock
program to activate as soon as possible. Of course there are cracks in
this, the eavesdropper could detach your monitor and insert a non-DPMS
one, and there are race conditions. As mentioned above this is not
bulletproof. A really robust solution would likely require X server
and perhaps even video hardware support.
The blockdpy utility is launched by the -accept option and told to
exit via the -gone option (the vnc client user should obviously
re-lock the screen before disconnecting!) Instructions can be found in
the source code for the utility at the above link. Roughly it is
something like this:
x11vnc ... -accept "blockdpy -bg -f $HOME/.bdpy" -gone "touch $HOME/.bdpy"
but please read the top of the file.
Update: As of Feb/2007 there is some builtin support for this:
-forcedpms and -clientdpms however, they are probably less robust than
the above blockdpy.c scheme, since if the person floods the physical
machine with mouse or pointer input he can usually see flashes of the
screen before the monitor is powered off again. See also the -grabkbd,
-grabptr, and -grabalways options.
Q-49: Can I have x11vnc automatically lock the screen when I
disconnect the VNC viewer?
Yes, a user mentions he uses the -gone option under CDE to run a
screen lock program:
x11vnc -display :0 -forever -gone 'dtaction LockDisplay'
Other possibilities are:
x11vnc -display :0 -forever -gone 'xscreensaver-command -lock'
x11vnc -display :0 -forever -gone 'kdesktop_lock'
x11vnc -display :0 -forever -gone 'xlock &'
x11vnc -display :0 -forever -gone 'xlock -mode blank &'
Here is a scheme using the -afteraccept option (in version 0.8) to
unlock the screen after the first valid VNC login and to lock the
screen after the last valid VNC login disconnects:
x11vnc -display :0 -forever -shared -afteraccept ./myxlocker -gone ./myxlocke
r
Where the script ./myxlocker is:
#!/bin/sh
#/usr/bin/env | grep RFB_ | sort # for viewing RFB_* settings.
if [ "X$RFB_MODE" = "Xafteraccept" ]; then
if [ "X$RFB_STATE" = "XNORMAL" ]; then # require valid login
if [ "X$RFB_CLIENT_COUNT" = "X1" ]; then
killall xlock # Linux only.
fi
fi
elif [ "X$RFB_MODE" = "Xgone" ]; then
if [ "X$RFB_STATE" = "XNORMAL" ]; then # require valid login
if [ "X$RFB_CLIENT_COUNT" = "X0" ]; then
xlock -mode blank &
fi
fi
fi
Note the xlock option "-mode blank" to avoid animations.
There is a problem if you have x11vnc running this way in -forever
mode and you hit Ctrl-C to stop it. The xlock (or other program) will
get killed too. To work around this make a little script called
setpgrp that looks like:
#!/usr/bin/perl
setpgrp(0, 0);
exec @ARGV;
then use -gone "setpgrp xlock &", etc.
[Encrypted Connections]
Q-50: How can I tunnel my connection to x11vnc via an encrypted SSH
channel between two Unix machines?
See the description earlier on this page on how to tunnel VNC via SSH
from Unix to Unix. A number of ways are described along with some
issues you may encounter.
Other secure encrypted methods exists, e.g. stunnel, IPSEC, various
VPNs, etc.
See also the Enhanced TightVNC Viewer (SSVNC) page where much of this
is now automated.
Q-51: How can I tunnel my connection to x11vnc via an encrypted SSH
channel from Windows using an SSH client like Putty?
Above we described how to tunnel VNC via SSH from Unix to Unix, you
may want to review it. To do this from Windows using Putty it would go
something like this:
* In the Putty dialog window under 'Session' enter the hostname or
IP number of the Unix machine with display to be viewed.
* Make sure the SSH protocol is selected and the server port is
correct.
* Under 'Connections/SSH/Tunnels' Add a Local connection with
'Source port: 5900' and 'Destination: localhost:5900'
* Log into the remote machine by pressing 'Open' and supplying
username, password, etc.
* In that SSH shell, start up x11vnc by typing the command: x11vnc
-display :0 plus any other desired options (e.g. -localhost.)
* Finally, start up your VNC Viewer in Windows and enter
'localhost:0' as the VNC server.
You can keep all of the settings in a Putty 'Saved Session'. Also,
once everything is working, you can consider putting x11vnc -display
:0 (plus other cmdline options) in the 'Remote command' Putty setting
under 'Connections/SSH'.
See also the Enhanced TightVNC Viewer (SSVNC) page where much of this
is now automated via the Putty plink utility.
For extra protection feel free to run x11vnc with the -localhost and
-rfbauth/-passwdfile options.
If the machine you SSH into via Putty is not the same machine with the
X display you wish to view (e.g. your company provides incoming SSH
access to a gateway machine), then you need to change the above Putty
dialog setting to: 'Destination: otherhost:5900', Once logged in,
you'll need to do a second login (ssh or rsh) to the workstation
machine 'otherhost' and then start up x11vnc on it. This can also be
automated by Chaining SSH's.
As discussed above another option is to first start the VNC viewer in
"listen" mode, and then launch x11vnc with the "-connect localhost"
option to establish the reverse connection. In this case a Remote port
redirection (not Local) is needed for port 5500 instead of 5900 (i.e.
'Source port: 5500' and 'Destination: localhost:5500' for a Remote
connection.)
Q-52: How can I tunnel my connection to x11vnc via an encrypted SSL
channel using an external tool like stunnel?
It is possible to use a "lighter weight" encryption setup than SSH or
IPSEC. SSL tunnels such as stunnel (also stunnel.org) provide an
encrypted channel without the need for Unix users, passwords, and key
passphrases required for ssh (and at the other extreme SSL can also
provide a complete signed certificate chain of trust.) On the other
hand, since SSH is usually installed everywhere and firewalls often
let its port through, ssh is frequently the path of least resistance
(it also nicely manages public keys for you.)
Update: As of Feb/2006 x11vnc has the options -ssl, -stunnel, and
-sslverify to provide integrated SSL schemes. They are discussed in
the Next FAQ (you probably want to skip to it now.)
We include these non-built-in method descriptions below for historical
reference. They are handy because can be used to create SSL tunnels to
any VNC (or other type of) server.
Here are some basic examples using stunnel but the general idea for
any SSL tunnel utility is the same:
* Start up x11vnc and constrain it to listen on localhost.
* Then start up the SSL tunnel running on the same machine to
forward incoming connections to that x11vnc.
* Set up and run a similar SSL tunnel for the outgoing connection on
the VNC viewer machine pointing it to the SSL/x11vnc server.
* Optionally, set up server (or even client) public/private keys for
use in authenticating one side to the other.
* Finally, start the VNC Viewer and tell it to connect to the local
port (e.g. a vnc display localhost:0) where its outgoing SSL
tunnel is listening.
We'll first use the stunnel version 3 syntax since it is the most
concise and Unixy.
Start up x11vnc listening on port 5900:
x11vnc -display :0 -rfbport 5900 -localhost -bg -passwdfile ~/mypass
Then start stunnel (version 3, not 4) with this command:
stunnel -d 5901 -r 5900 -p /path/to/stunnel.pem
The above two commands are run on host "far-away.east". The
stunnel.pem is the self-signed PEM file certificate created when
stunnel is built. One can also create certificates signed by
Certificate Authorities or self-signed if desired using the x11vnc
utilities described there.
SSL Viewers: Next, on the VNC viewer side we need an SSL tunnel to
encrypt the outgoing connection. The nice thing is any SSL tunnel can
be used because the protocol is a standard. For this example we'll
also use stunnel on the viewer side on Unix. First start up the
client-side stunnel (version 3, not 4):
stunnel -c -d localhost:5902 -r far-away.east:5901
Then point the viewer to the local tunnel on port 5902:
vncviewer -encodings "copyrect tight zrle hextile" localhost:2
That's it. Note that the ss_vncviewer script can automate this
easily, and so can the Enhanced TightVNC Viewer (SSVNC) package.
Be sure to use a VNC password because unlike ssh by default the
encrypted SSL channel provides no authentication (only privacy.) With
some extra configuration one could also set up certificates to provide
authentication of either or both sides as well (and hence avoid
man-in-the-middle attacks.) See the stunnel and openssl documentation
and also the key management section for details.
stunnel has also been ported to Windows, and there are likely others
to choose from for that OS. Much info for using it on Windows can be
found at the stunnel site and in this article The article also shows
the detailed steps to set up all the authentication certificates. (for
both server and clients, see also the x11vnc utilities that do this.)
The default Windows client setup (no certs) is simpler and only 4
files are needed in a folder: stunnel.exe, stunnel.conf, libssl32.dll,
libeay32.dll. We used an stunnel.conf containing:
# stunnel.conf:
client = yes
options = ALL
[myvncssl]
accept = localhost:5902
connect = far-away.east:5901
then double click on the stunnel.exe icon to launch it (followed by
pointing the VNC viewer to localhost:2).
stunnel inetd-like mode:
As an aside, if you don't like the little "gap" of unencrypted TCP
traffic (and a localhost listening socket) on the local machine
between stunnel and x11vnc it can actually be closed by having stunnel
start up x11vnc in -inetd mode:
stunnel -p /path/to/stunnel.pem -P none -d 5900 -l ./x11vnc_sh
Where the script x11vnc_sh starts up x11vnc:
#!/bin/sh
x11vnc -q -inetd -display :0 -passwdfile ~/mypass
Note that this creates a separate x11vnc process for each incoming
connection (as any inetd x11vnc usage would), but for the case of
normally just one viewer at a time it should not be a big problem.
stunnel 4 syntax:
Somewhat sadly, the stunnel version 4 syntax is not so amenable to the
command line or scripts. You need to create a config file with the
parameters. E.g.:
stunnel x11vnc.cfg
Where the file x11vnc.cfg contains:
foreground = yes
pid =
cert = /path/to/stunnel.pem
[x11vnc_stunnel]
accept = 5901
connect = 5900
One nice thing about version 4 is often the PEM file does not need to
be specified because stunnel finds it in its installed area. One other
gotcha the PEM file is usually only readable by root (it has the
private key afterall), so you'll need to relax the permissions or make
a copy that the user running x11vnc/stunnel can read.
SSL VNC Viewers:
Regarding VNC viewers that "natively" do SSL unfortunately there do
not seem to be many. The SingleClick UltraVNC Java Viewer is SSL and
is compatible with x11vnc's -ssl option and stunnel.) Commercial
versions of VNC seem to have some SSL-like encryption built in, but we
haven't tried those either and they probably wouldn't work since their
(proprietary) SSL-like negotiation is likely embedded in the VNC
protocol unlike our case where it is external.
Note: as of Mar/2006 libvncserver/x11vnc provides a SSL-enabled Java
applet that can be served up via the -httpdir or -http options when
-ssl is enabled. It will also be served via HTTPS via either the VNC
port (e.g. https://host:5900/) or a 2nd port via the -https option.
In general current SSL VNC solutions are not particularly "seemless".
But it can be done, and with a wrapper script on the viewer side and
the -stunnel or -ssl option on the server side it works well and is
convenient. Here is a simple script ss_vncviewer that automates
running stunnel on the VNC viewer side on Unix a little more carefully
than the commands printed above. (One could probably do a similar
thing with a .BAT file on Windows in the stunnel folder.)
Update Jul/2006: we now provide an Enhanced TightVNC Viewer (SSVNC)
package that starts up STUNNEL automatically along with some other
features. All binaries (stunnel, vncviewer, and some utilities) are
provided in the package. It works on Unix, Mac OS X, and Windows.
Q-53: Does x11vnc have built-in SSL tunneling?
You can read about non-built-in methods in the Previous FAQ for
background.
SSL tunnels provide an encrypted channel without the need for Unix
users, passwords, and key passphrases required for ssh (and at the
other extreme SSL can also provide a complete signed certificate chain
of trust.) On the other hand, since SSH is usually installed
everywhere and firewalls often let its port through, ssh is frequently
the path of least resistance.
Built-in SSL x11vnc options:
As of Feb/2006 the x11vnc -ssl option automates the SSL tunnel
creation on the x11vnc server side. An SSL-enabled Java Viewer applet
is also provided that can be served via HTTP or HTTPS to automate SSL
on the client side.
The -ssl mode uses the www.openssl.org library if available at build
time.
The mode requires an SSL certificate and key (i.e. .pem file.) These
are usually created via the openssl(1) program (in fact in for "-ssl"
(same as "-ssl SAVE") it will run openssl for you automatically.) So
the SSL is not completely "built-in" since this external tool needs to
be installed, but at least x11vnc runs it for you automatically.
An -ssl example:
x11vnc -display :0 -ssl -passwdfile ~/mypass
You'll get output like this:
09/04/2006 19:27:35 Creating a self-signed PEM certificate...
09/04/2006 19:27:35
...
The SSL VNC desktop is: far-away.east:0
PORT=5900
SSLPORT=5900
In this case openssl(1) was used to create a PEM automatically. It
will prompt you if you want to protect it with with a passphrase. Use
"-ssl SAVE_NOPROMPT" to not be prompted. Use "-ssl TMP" to create a
temporary self-signed cert that will be discarded when x11vnc exits.
Update: As of Nov/2008 x11vnc also supports the VeNCrypt SSL/TLS
tunnel extension to the VNC protocol. The older ANONTLS method (vino)
is also supported. This support is on by default when the -ssl option
is in use and can be fine-tuned using these options: -vencrypt,
-anontls, and -sslonly.
The normal x11vnc -ssl operation is somewhat like a URL method
vncs://hostname if vnc://hostname indicates a standard unencrypted VNC
connection. Just as https://hostname is an SSL encrypted version of
http://hostname. The entire VNC session goes through the SSL tunnel.
VeNCrypt, on the other hand, switches to SSL/TLS early in the VNC
protocol handshake. x11vnc 0.9.6 supports both simultaneously when
-ssl is active.
Note: With the advent of OpenSSL 1.1.0, SSLv2 is dropped and SSLv3
deactivated per default. A couple broken ciphers have also gone, most
importantly though is that clients trying to connect to x11vnc will
now have to support TLS if encryption is to be used. You can of
course always cook up your own build and run time OpenSSL 1.1.x if
SSLv3 is absolutely required, but it isn't wise from a security point
of view.
SSL VNC Viewers:. Viewer-side will need to use SSL as well. See the
next FAQ and here for SSL enabled VNC Viewers, including SSVNC, to
connect to the above x11vnc via SSL.
As seen above, the PEM (privacy enhanced mail) file does not need to
be supplied if the openssl(1) command is available in PATH, in that
case a self-signed, certificate good the current and subsequent x11vnc
sessions is created (this may take a while on very slow machines.)
In general, the PEM file contains both the Certificate (i.e. public
key) and the Private Key. Because of the latter, the file should be
protected from being read by untrusted users. The best way to do this
is to encrypt the key with a passphrase (note however this requires
supplying the passphrase each time x11vnc is started up.)
See the discussion on x11vnc Key Management for some utilities
provided for creating and managing certificates and keys and even for
creating your own Certificate Authority (CA) for signing VNC server
and client certificates. This may be done by importing the certificate
into Web Browser or Java plugin keystores, or pointing stunnel to it.
The wrapper script ss_vncviewer provides an example on unix (see the
-verify option.)
Here are some notes on the simpler default (non-CA) operation. To have
x11vnc save the generated certificate and key, use the "SAVE" keyword
like this:
x11vnc -ssl SAVE -display :0 ...
(this is the same as the default: "-ssl".) This way it will be saved
in the default directory ~/.vnc/certs/ as server.crt (the certificate
only) and server.pem (both certificate and private key.) This opens up
the possibility of copying the server.crt to machines where the VNC
Viewer will be run to enable authenticating the x11vnc SSL VNC server
to the clients. When authentication takes place this way (or via the
more sophisticated CA signing described here), then
Man-In-The-Middle-Attacks are prevented. Otherwise, the SSL encryption
only provides protection against passive network traffic "sniffing"
(i.e. you are not protected against M-I-T-M attacks.) Nowadays, most
people seem mostly concerned mainly about passive sniffing (and the
default x11vnc SSL mode protects against it.) Note that there are
hacker tools like dsniff/webmitm and cain that implement SSL
Man-In-The-Middle attacks. They rely on the client not bothering to
check the cert.
One can test to some degree that SSL is working after starting x11vnc
with the -stunnel or -ssl option. From another machine one can use the
openssl command something like this:
openssl s_client -debug -msg -showcerts -connect far-away.east:5900
After all of the debugging output and informational messages you'll
see the string "RFB 003.008" that came from x11vnc. Pointing a web
browser connecting to: https://far-away.east:5900/ and then viewing
the SSL certificate information about the connection in the panels
will also work.
Note: If you serve up the SSL enabled Java VNC Viewer via something
like:
x11vnc -ssl -httpdir /usr/local/share/x11vnc/classes/ssl
(or just the -http option), you can test it out completely using that,
including using https to download it into the browser and connect to
x11vnc.
The older -stunnel option: Before the -ssl option there was a
convenience option -stunnel that would start an external SSL tunnel
for you using stunnel. The -ssl method is the preferred way, but for
historical reference we keep the -stunnel info here.
The -stunnel mode requires the stunnel.mirt.net command stunnel(8) to
be installed on the system.
Some -stunnel examples:
x11vnc -display :0 -stunnel /path/to/stunnel.pem -passwdfile ~/mypass
x11vnc -display :0 -stunnel SAVE ...
You'll get output like this:
The VNC desktop is: localhost:50
The SSL VNC desktop is: far-away.east:0
PORT=5950
SSLPORT=5900
That indicates stunnel is listening on port 5900 for incoming
SSL-wrapped VNC connections from viewers. x11vnc is listening for
local connections on port 5950 in this case (remote viewers cannot
connect to it directly.) For -stunnel to work the stunnel command must
be installed on the machine and available in PATH (note stunnel is
often installed in sbin directories rather than bin.) Note that the
default "-stunnel" by itself creates a temporary cert (as in "-ssl
TMP".)
Q-54: How do I use VNC Viewers with built-in SSL tunneling?
Notes on using "native" VNC Viewers with SSL:
There aren't any native VNC Viewers that do SSL (ask your VNC viewer
developer to add the feature.) So a tunnel must be setup that you
point the VNC Viewer to. This is often STUNNEL. You can do this
manually, or use the ss_vncviewer script on Unix, or our Enhanced
TightVNC Viewer (SSVNC) package on Unix, Windows, or MacOSX. See the
next section for Java Web browser SSL VNC Viewers (you only need a
Java-enabled Web browser for it to work.)
Notes on the SSL enabled Java VNC Viewer provided in x11vnc
classes/ssl/VncViewer.jar:
A Java applet VNC