[Guide] How To Set Up X11VNC Server For Access To The Current Running Session

A Little Background First
-Manjaro user @pixel27 was great at getting me started with Vino VNC Server from my post here Can Someone Help Me With Remote Access.
-I had a major problem with Vino on XFCE where my .xsession-errors folder would build up constantly over several days with Vino errors to the point where it would max out my hard drive. Could not find an answer so I switched to TigerVNC.
-TigerVNC had it's issues too. Autostarting via systemd would not work in accordance to the Arch Wiki, I had to make a custom script to execute it. Copy & Paste would not work either - again the Wiki's guide just did not work. And finally I could not connect via Android (and there is no openly known solution for this either).
-So I switched again to x11vnc BUT there are some things I had to do very differently from the Arch Wiki, so I'm going to write up a guide here for other users that want to set up a simple VNC server for easy access to a currently running X-session, aka mirror currently running screen (not a virtual session).

Steps For XFCE:

1: Forward port #5900 to your server computer from your router

2: Install x11vnc
pacman -S x11vnc

3: Set Password
x11vnc -storepasswd

Note: This can point to another location if you choose, but the default setting will automatically choose /home/your_user_name/.vnc/passwd and that is what I'll use for this guide.

4: Create A Log File
Manually create an x11vnc.log file in: /home/your_user_name/.vnc/x11vnc.log

5: Command To Execute To Start (change your_user_name to your user name!)
x11vnc -nap -wait 50 -noxdamage -rfbauth /home/your_user_name/.vnc/passwd -display :0 -nocursor -forever -o /home/your_user_name/.vnc/x11vnc.log -bg

Notes: the rfbauth & log commands differ from Arch Wiki. The -nocursor command uses the host computer's mouse pointer instead of the default weird "arrow" that x11vnc uses.

6: Autostarting By Systemd (preferred method)
Stop the running service if you already have it running. Search in the task manager for x11vnc and right click & terminate. Create an x11vnc.service file as root in: /etc/systemd/system/x11vnc.service and add this to the file (substitute your_user_name everywhere it's written with your user name):

Description=VNC Server for X11

ExecStart=/usr/bin/x11vnc -nap -wait 50 -noxdamage -rfbauth /home/your_user_name/.vnc/passwd -display :0 -nocursor -forever -o /home/your_user_name/.vnc/x11vnc.log -bg


7: Run These Commands To Enable
sudo systemctl start x11vnc.service
sudo systemctl enable x11vnc.service

8: Optional Alternate Autostart Method By Script (Do not use in conjunction with systemd method)
Create a file called x11vnc.sh anywhere you want to save a script and add this to the file:

x11vnc -nap -wait 50 -noxdamage -rfbauth /home/your_user_name/.vnc/passwd -display :0 -nocursor -forever -o /home/your_user_name/.vnc/x11vnc.log -bg

Now right click the file, go to properties/permissions and check off "allow this file to run as a program". Add the file to your autostart applications by making a custom entry in settings/session and startup/application autostart and point the entry to where you saved the x11vnc.sh file. Name the startup entry whatever you want.

9: Reboot
That's it, your x11vnc server is now working and ready to connect remotely from another computer/Android. You can verify the systemd service is running and active by running this command:

'systemctl status x11vnc.service`

Or just open your task manager and search for x11vnc and you should see it running.

Connecting From Another Computer/Android:

1: Install remmina & libvncserver
sudo pacman -S remmina libvncserver

2: Local LAN Connection Via Remmina
Click the + add connection button. Name the profile. Choose VNC - Virtual Network Computing as your protocol. For the address add your local IP address (you can get this by right clicking the network manager and selecting connection information). Enter your password (no user name required). Choose your color depth (I recommend True Color 24bit or 32bit). Choose your quality and save the profile. Now just select it and you should connect right away.

3: Outside LAN Access (Note: insecure unless ssh is used)
For outside your LAN connections use your external IP address instead of your local IP address. You can get this by running "what's my IP" from your browser.

4: For Connecting Via Android
bVNCpro is working great https://play.google.com/store/apps/details?id=com.iiordanov.bVNC&hl=en


You should be aware that the VNC protocol has no transport encryption. Your password is in clear text send over the internet to your system at home. If someone monitor the network your password is then known by someone else.

To prevent that, you can use a SSH tunnel. This is supported by many VNC clients, even on Android and iOS.

I'm guessing that's only if your accessing outside of your LAN. I'm still learning all this stuff. From what I'm reading using SSH solves that issue. I don't know much about that, so when I learn it I'll add it to the guide. Any recommended guides for setting up ssh?

For now I'll note that section as being insecure. Thanks.


This is a good starting point. You should use AllowUsers and change the port. Then forward this port and not 5900 form your router to your server.


Forum kindly sponsored by