X11VNC is the popular VNC server for creating remote desktop connection and access the remote desktop. It works will almost all the desktop environments available for Ubuntu and Debian based systems. Using remote desktop connection we can connect any remote system and access graphical user interface and work. We can use any available vnc viewer like the tight vnc viewer, real vnc viewer or ultra vnc viewer.
X11VNC can be a better remote support software for you. This tutorial will help you to set up the x11vnc server on your Ubuntu, LinuxMint & Debian system and connect using vnc viewer from the client system.
Step 1 – Install X11VNC
X11vnc packages are available under default repositories. Open a terminal and run the following commands to update default repositories and install required packages.
sudo apt-get update sudo apt-get install x11vnc net-tools
Step 2 – Create Password
Now create a password to connect using vnc viewer from the client system. This will not require any username to connect vnc.
x11vnc -storepasswd Enter VNC password:********* Verify password:********* Write password to /home/rahul/.vnc/passwd? [y]/ny Password written to: /home/rahul/.vnc/passwd
Step 3 – Start X11VNC Server
After the successful installation of the x11vnc server on your system. Let’s start it using the following command. Change the parameters as per your setup.
sudo x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/rahul/.vnc/passwd -rfbport 5900 -shared
The VNC server will start on default port 5900. In case the port 5900 is busy with some other service, it will automatically select the next available port like 5901.
Step 4 – Connect from VNC Clinet
To connect to the server using VNC, you need a VNC client on your system. For this tutorial, I am using RealVNC viewer on our system. You can use any other client of your choice.
Step 5 – Setup AutoStart on Boot
Finally setup the auto start of x11vnc server on system boot. Create a x11vnc.conf file under /etc/init/ directory using following content.
sudo vi /etc/init/x11vnc.conf
# description "Start x11vnc on system boot" description "x11vnc" start on runlevel [2345] stop on runlevel [^2345] console log respawn respawn limit 20 5 exec /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/rahul/.vnc/passwd -rfbport 5900 -shared
Conclusion
You can successfully configured VNC server on your Ubuntu or Debian system.
56 Comments
Thanks a lot Rahul!
After a lot of grinding I was able able to setup VNC on LXQt Lubuntu, but alas it would create a new session instead of just remote control the existing one.
This is a such a simple solution!
I downloaded MX-19.3_386.iso, did no system updates and setup x11vnc with their installer was a real pain in the arse (can’t remote login) but this manual get it to work. THANK YOU!!!
I have set it up and it is working fine. Thank you so much for your guidance.
Can you please help to enable file transfer from client to server and guide how to do file server.
Just install openssh and open port 22 on your server and network firewall. SSH and FTP will work.
I installed a server following these instructions. But what to do on the client-side to connect? What’s the connect address if the server is hidden behind NAT?
When I try x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/{USER}/.vnc/passwd -rfbport 5900 -shared I get the following output spammed over and over:
— x11vnc loop: 1 —
— x11vnc loop: waiting for: 35530
09/07/2020 12:35:54 passing arg to libvncserver: -rfbauth
09/07/2020 12:35:54 passing arg to libvncserver: /home/{USER}/.vnc/passwd
09/07/2020 12:35:54 passing arg to libvncserver: -rfbport
09/07/2020 12:35:54 passing arg to libvncserver: 5900
09/07/2020 12:35:54 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 35530
09/07/2020 12:35:54 -auth guess: failed for display=’localhost:10.0′
— x11vnc loop: sleeping 2000 ms —
Has anyone ran into this and if so found a solution for it?
Have you installed net-tools as well?
try to run without “sudo”
I am trying to get this to autorun on startup. I have done so once by another way, but I cannot remember how. Now I am trying to set this up on a different computer and cannot remember what I did. I am using Linus Mint. I am moving over to the newest 20 version.
Everything works fine up to the point of setting up the autostart. Any help would be appreciated. I can’t seem to figure it out.
John
This article suggests placing an x11vnc.conf file in /etc/init. That didn’t do anything for me. But I have success with this:
1) Start x11vnc manually. I just launched it from the main menu – it’s under internet after a “normal” install
2) Use the system tray gui to tweak settings, and then under Advanced – Actions – Settings use the save-settings command to create a config file “~/.x11vncrc”. Note that this does NOT save the password. It will still prompt you for it locally. Which is quite annoying if you are remote and need to reboot your home/office system.
3) Use the command line “x11vnc -storepasswd” to generate the encrypted authentication file “~/.vnc/passwd”. Then edit the “~/.x11vncrc” file and uncomment the -rfbauth line and use the full path “/home//.vnc/passwd” as the parameter.
4) Go to the main Mint menu – settings, open Startup Applications, and add the x11vnc app there. In the startup command field, use “x11vnc -rc /home//.x11vnc”. I also have had better success adding a 10-15 second delay in that same startup dialog box.
If it is still running, go to the system tray, right-click the x11vnc icon, and choose Stop (or use any other means you choose to kill the process. Then while still in the Settings – Startup Applications screen, highlight the app and click the gear symbol at the bottom to test the launch. It should start in a few seconds. Then test connecting from a viewer to verify all is good.
All this is assuming Cinnamon desktop, but it seems like I did essentially the exact same thing with XFCE. Not sure about other desktops. Works great when connecting from another Linux pc running Remmina. Works well enough from Windows with TightVNC viewer, but I have to play with scaling a bit because it tries to send all my active desktops/workspaces and multiple monitors vertically stacked and I really want to just see one workspace at a time like I would if I was actually looking at the screen locally. To tell the truth, I have switched over to AnyDesk for most of my remote access needs, but still have vnc running as a backup.
Good luck
Hi,
Just installed Ubuntu 20.04.LTS and X11VNC wasn’t working using:
$ sudo x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/rahul/.vnc/passwd -rfbport 5900 -shared
the console was “spitting out” -auth guess: failed for display:’:0′
I had to do extra steps:
Disabled “Wayland” display manager by editing /etc/gdm3/custom.conf and setting WaylandEnable=false
Execute:
x11vnc -auth /run/user/1000/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbauth /home/USERNAME/.vnc/passwd -rfbport 5900 -shared
Also, the “autostart on Boot” doesn’t work.
I’m using a 18.04 LTS fresh install upgraded to 20.04 LTS. So maybe this /etc/init/… is “deprecated”.
Still trying to figure this one out.
hi , i have multiples screens when im scrolling down (while im connected), how to fix that ?
–nocache
Hello, I am trying to turn an old desktop into a server, I installed Ubuntu and now I want to have a vnc installed. The installation worked fine but I am stuck at the password, every time I try to create the password file it says it did so and it appears in the files but when I try to connect from a different device it always says that the password that I filled in is wrong. I tried 4 different passwords (removing things like @ . _) but it still gives the error message on the other device
When starting the server with this command:
sudo x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/rahul/.vnc/passwd -rfbport 5900 -shared
change the dir to your home dir, i.e. change rahul to your user
To the author of the post – you should just change /home/rahul/.vnc/passwd to $HOME/.vnc/passwd
Works still great…
Set it up in 5 minutes. I would change it a little and use Caisy’s systemctl option.
I should add that I was working on (as mentioned updating all systems) and had installed Linux Mint 19.3 where VNC became the issue. It was working on my earlier systems.
Anyhow, as mentioned working perfectly on Mint 19.3
Regards
Bob
Thank you to Rahul, Caisy and Mattg,
Like others on this forum, there are so many sites with solutions that just don’t work with Mint 19.x (and a lot of time wasted).
Due to this Corona lockdown, I have quickly had to rebuild my lab with all systems updated so that I can progress with some work, so the VNC is a very small part, but an important part for speed, if it was the only issue I was working on I would spend a few hours looking at the issue, but cannot, so vary much appreciate Rahul’s article and the other knowledgeable posters, particularly Caisy and Mattg as well as all the other comments
It didn’t work for me at first. The error I got was
/tmp/fd.qUioJx: 1: /tmp/fd.qUioJx: netstat: not found
11/03/2020 11:29:45 -auth guess: failed for display=’:0′
The solution was to install netstat:
sudo apt install net-tools
Thanks Josh. Your contribution will help other users.
I double Marco’s opinion.
this is the best tutorial among at least 15 I went through.
and by far as well
I think it would be nice if you dedicated a liitle space to explaining your choice of options, what they all mean and do and why you choose them. It is by no means clear fro example why you elect to us -noxdamage and -repeat.
I was able to find a solution to why I was not getting x11vnc server to work. You may need to have the
All users may connect to this network checked in the general tab of the Network Connections manager.
This enabled the IP to be loaded before the x11vnc service.
Thanks for your help. I am able to use vncviewer with your setup. It still will not load at the login prompt.
Any ideas on what I need to do to get the boot up functionality working? I am using LM 19.1.
For AUTOSTART :
1. make file x11vnc.service in /etc/systemd/system :
sudo mcedit /etc/systemd/system/x11vnc.service (mcedit – my prefered editor , i’m sorry for vi :)))
with text (change RAHUL for you name):
[Unit]
Description=x11vnc remote desktop server
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/RAHUL/.vnc/passwd -rfbport 5900 -shared
Restart=on-failure
[Install]
WantedBy=multi-user.target
2. sudo systemctl daemon-reload
sudo systemctl start x11vnc
sudo systemctl status x11vnc
3. if it’s worked
sudo systemctl enable x11vnc.service
et voila
This was very helpful and work great. Thanks!
Awesome, this worked perfectly for me. Thank you very much.
Hi
I am running into something strange that I could not work out:
I have followed the installation in Lubuntu 18.04 and it works perfectly
BUT Now; I am learning Ubuntu 18.04.2 LTS, install x11vnc the same way
Could not start service using following command:
sudo x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/jacky/.vnc/passwd -rfbport 5900 -shared
Error below:
23/02/2019 19:08:42 passing arg to libvncserver: -rfbauth
23/02/2019 19:08:42 passing arg to libvncserver: /home/jacky/.vnc/passwd
23/02/2019 19:08:42 passing arg to libvncserver: -rfbport
23/02/2019 19:08:42 passing arg to libvncserver: 5900
23/02/2019 19:08:42 x11vnc version: 0.9.13 lastmod: 2011-08-10 pid: 2185
^X23/02/2019 19:08:42 -auth guess: failed for display=’:0′
23/02/2019 19:08:42 -auth guess: since we are root, retrying with FD_XDM=1
23/02/2019 19:08:42 -auth guess: failed for display=’:0′
— x11vnc loop: sleeping 2000 ms —
############
so I ran it without sudo and it works:
x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/jacky/.vnc/passwd -rfbport 5900 -shared
Log in from windows RDC no problem.
##################
But I am not able to get it auto start.
###########
I used exactly CAISY method of systemctl
it is NOT working in Ubuntu (It was working on Lubuntu)
Error below:
[email protected]:~$ sudo nano /etc/systemd/system/x11vnc.service
[email protected]:~$ sudo chmod +x /etc/systemd/system/x11vnc.service
[email protected]:~$ sudo systemctl –system daemon-reload
[email protected]:~$ sudo systemctl start x11vnc
[email protected]:~$ sudo systemctl status x11vnc
● x11vnc.service – x11vnc remote desktop server
Loaded: loaded (/etc/systemd/system/x11vnc.service; disabled; vendor preset: enabled)
Active: active (running) since Sat 2019-02-23 19:19:06 AEDT; 10s ago
Main PID: 2603 (x11vnc)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/x11vnc.service
└─2603 /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/jack
Feb 23 19:19:15 jackyhp x11vnc[2603]: 23/02/2019 19:19:15 passing arg to libvncserver: /home/jacky/
Feb 23 19:19:15 jackyhp x11vnc[2603]: 23/02/2019 19:19:15 passing arg to libvncserver: -rfbport
Feb 23 19:19:15 jackyhp x11vnc[2603]: 23/02/2019 19:19:15 passing arg to libvncserver: 5900
Feb 23 19:19:15 jackyhp x11vnc[2603]: 23/02/2019 19:19:15 x11vnc version: 0.9.13 lastmod: 2011-08-1
Feb 23 19:19:15 jackyhp x11vnc[2603]: xauth: unable to generate an authority file name
Feb 23 19:19:15 jackyhp x11vnc[2603]: 23/02/2019 19:19:15 -auth guess: failed for display=’unset’
Feb 23 19:19:15 jackyhp x11vnc[2603]: 23/02/2019 19:19:15 -auth guess: since we are root, retrying
Feb 23 19:19:15 jackyhp x11vnc[2603]: 23/02/2019 19:19:15 -auth guess: failed for display=’unset’
Feb 23 19:19:15 jackyhp x11vnc[2603]: — x11vnc loop: sleeping 2000 ms —
Feb 23 19:19:17 jackyhp x11vnc[2603]: — x11vnc loop: 5 —
lines 1-18/18 (END)
#################################
try rc.local approach not working
rc.local does not exist on this Ubuntu installation.
##############
################################
adding xllvnc.conf do not work
sudo nano /etc/init/x11vnc.conf
# description “Start x11vnc on system boot”
description “x11vnc”
start on runlevel [2345]
stop on runlevel [^2345]
console log
respawn
respawn limit 20 5
exec /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/rahul/.vnc/passwd -rfbport 5900 -shared
############################
Any Kind Person can help me here?
Thanks in advance
I have the same problem, very annoying. On one fresh linux box it works flawless, on the other fresh linux box i have this very same issue.
Thank you Caisy, and of course thanks to Rahul
I had the same issue with running x11vnc when I tried the conf file. I setup the service file and could not get it to load. The issue I found was that I logged into my unbuntu desktop as user recorder but root was trying to run the service and attach to the desktop. This is what my service file looks like.
I added the User=recorder and Group=recorder. The service then started at the user logged into the GUI and it worked!
[Unit]
Description=x11vnc remote desktop server
After=multi-user.target
[Service]
User=recorder
Group=recorder
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/recorder/.vnc/passwd -rfbport 5900 -shared
Restart=on-failure
[Install]
WantedBy=multi-user.target
Thank you MATTG, I had the same issue on Ubuntu 18.04 with
xauth: unable to generate an authority file name
-auth guess: failed for display=’:0′
-auth guess: since we are root, retrying with FD_XDM=1
-auth guess: failed for display=’:0′
Adding the User and Group options to the service file fixed it.
Adding User and Group fixed it for me as well.
USER and GROUP, there you go! thx!
Thank you MATTG
With your detail and explanation its working well (LunixMint 19.3)
roland
This worked for me as well on Linux Mint 20, awesome!
Hello,
This worked for me on Ubuntu 20.04.2 LTS.
Thank you! You rock Caisy!
Thank you, after many tutorial, this work immediately with x11vnc. great!
I’ve followed the instructions herein and continue to receive the error message…’password check failed’. Suggestions?
Hey, replace the command with the right username 😉
autostart isn’t working. have you checked autostart?
Dear Batmunkh,
I am relatively new to linux and have just succeed get the VNC connection working. Nevertheless, I am also interested in having the autostart working. I already tried putting the command into “Startup Applications”, but it didn’t work. Would you be so kind to help me find where and how to check for the autostart?
you are a time and energy saver.thanks it worked
I tried following all your steps still its not working. When I try to see the VNC in browser it is not working. I tried localhost:5900 in browser?? Its not working??
Hi Ranjith,
What error are you getting? Have you tried with vnc viewer application?
autostart isn’t working. have you checked autostart?
Hi Rahul,
I have X11vnc in docker container and am accessing this vnc server via noVNC on browser.
Now my question is , not able to copy & paste to remote to local vice versa. Is it possible?
if yes let me know.
Nice and works – but if some other user is on the “server,” I can’t login. With other VNC servers I was, in the distant past, able to log in without controlling the user at the console. Is there a way to make this multi-user?
Thanks! Your instructions work!
Hi, Bojangles,
Please follow the below steps.
its working for me.
On Server
Step 1-:
Install the required x11vnc package in ubuntu.
$ sudo apt-get install -y x11vnc
Step 2-:
Create a password for a user.
$ x11vnc -storepasswd
Output-:
Enter VNC Password:
Verify password:
Write password to /home/user/.vnc/passwd? [y]/n y
Password written to: /home/user/.vnc/passwd
Step 3-:
To run the vnc server on every start automatically. We have to open /etc/rc.local file.
$ sudo nano /etc/rc.local
Copy the below line to start vnc session automatically with system startup, paste it the line before the “exit 0”.
sudo x11vnc -xkb -noxrecord -forever -noxfixes -noxdamage -display :0 -auth /var/run/lightdm/root/:0 -usepw &
Thanks, exactly what I was looking for.
Thanks for your reply. I was able to resolve it by moving the password file outside of the home dir as you had specified. I moved it to “/etc” and now it works at the login screen. Thanks again.
Good stuff and exactly what I am looking for! But unfortunately this is not working for me. When I try to connect via VNC to my Linux Mint instance which is at the login screen I get the following error; “password check failed”. But if I sit in front of the computer and login and then try to connect via VNC it works fine. Any ideas why I cannot get this working via the login screen?
Hi,
Use password you created with “x11vnc -storepasswd” command. System password is bit different than it.
Dear RAHUL
Thank you, step 1 to 4 is working great (LinuxMint 19.3). Step 5 don’t touched the automatic starting point.
= manual starting point
With the supplementation from CAISY it’s running great.