X11vnc
From ArchWiki
i18n |
---|
English |
简体中文 |
WARNING: This will set up VNC with NO PASSWORD. This means that ANYBODY who has access to the network the computer is on CAN SEE YOUR XSERVER. It is a fairly simple matter to tunnel your VNC connection through SSH to avoid this.
Contents |
Setting up x11vnc
Install
pacman -Sy x11vnc
Starting
You need to have a X server running first. Use startx or similar. After that you can run
startx
x11vnc -display :0 -auth ~/.Xauthority
if that fails, you may have to run (as root)
x11vnc -display :0 -autho /home/USER/.Xauthority
where USER is the username of the user who is running the X server.
GDM
as root, run
x11vnc -display :0 -auth /var/lib/gdm/:0.Xauth
SLIM
as root, run
x11vnc -display :0 -auth /var/run/slim.auth
Setting password
mkdir ~/.x11vnc x11vnc -storepasswd password ~/.x11vnc/passwd
Running constantly
If you just run x11vnc like
x11vnc -rfbauth ~/.x11vnc/passwd
It will accept the first vnc session and after you close the vncviewer the server will shutdown. In order to avoid that, start x11vnc like this:
x11vnc -many -rfbauth ~/.x11vnc/passwd
To start silently
x11vnc -many -display :0 -rfbauth ~/.x11vnc/passwd &>/dev/null &
Accessing
Get a VNC client on another computer, and type in the IP address of the computer running x11vnc. Hit connect, and you should be set.
SSH Tunnel
You need to have SSH installed and configured.
Use the -localhost flag to x11vnc to have it bind to the local interface. Once that is done, you can use SSH to tunnel the port, and then connect to VNC through SSH. (I haven't tried this) (confirmed working for me, thanks --bloodniece)
Simple example (from http://www.karlrunge.com/x11vnc/index.html#tunnelling):
$ ssh -t -L 5900:localhost:5900 remote_host 'sudo x11vnc -display :0 -auth /home/USER/.Xauthority'
where USER is the username of the user who is running the X server.
(you will likely have to provide passwords/passphrases to login from your current location into your remote_host Unix account; we assume you have a login account on remote_host and it is running the SSH server)
And then in another terminal window on your current machine run the command:
$ vncviewer -encodings "copyrect tight zrle hextile" localhost:0