Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Setup X11VNC Server on Ubuntu & LinuxMint

    How to Setup X11VNC Server on Ubuntu & LinuxMint

    By RahulApril 30, 20202 Mins Read

    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.

    Advertisement

    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]/n y
    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.

    setup x11vnc on ubuntu

    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.

    vnc vnc server vnc viewer x11vnc
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    An Introduction to the “./configure” Command: Compiling Source Code in Linux

    Getting Started with Linux Command line: The Beginning

    Backing Up Your Linux System with Rsync: A Step-by-Step Guide

    View 56 Comments

    56 Comments

    1. Himanshu on June 2, 2022 2:15 pm

      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!

      Reply
    2. Julian on January 30, 2021 9:55 pm

      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!!!

      Reply
    3. suresh on December 2, 2020 7:57 am

      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.

      Reply
      • a on October 14, 2021 2:35 am

        Just install openssh and open port 22 on your server and network firewall. SSH and FTP will work.

        Reply
    4. mercury0114 on October 30, 2020 10:59 am

      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?

      Reply
    5. Jason B on July 9, 2020 7:39 pm

      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?

      Reply
      • Damien on August 7, 2020 5:38 am

        Have you installed net-tools as well?

        Reply
      • Razi on August 18, 2020 9:38 am

        try to run without “sudo”

        Reply
    6. John M on June 16, 2020 2:42 pm

      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

      Reply
      • Mark W on November 2, 2020 10:34 am

        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

        Reply
    7. Peter on May 30, 2020 7:38 pm

      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.

      Reply
    8. DIMM_V2 on May 4, 2020 11:37 am

      hi , i have multiples screens when im scrolling down (while im connected), how to fix that ?

      Reply
      • DIMM_V2 on May 11, 2020 9:49 am

        –nocache

        Reply
    9. Tiago on April 29, 2020 7:44 am

      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

      Reply
      • Helper on April 30, 2020 2:03 pm

        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

        Reply
        • John on May 26, 2020 8:13 am

          To the author of the post – you should just change /home/rahul/.vnc/passwd to $HOME/.vnc/passwd

          Reply
    10. Jeroen on April 25, 2020 10:48 pm

      Works still great…
      Set it up in 5 minutes. I would change it a little and use Caisy’s systemctl option.

      Reply
    11. Bob Fryer on April 25, 2020 7:22 am

      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

      Reply
    12. Bob Fryer on April 25, 2020 7:19 am

      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

      Reply
    13. Josh Davis on March 11, 2020 3:35 pm

      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

      Reply
      • Rahul on March 12, 2020 6:33 am

        Thanks Josh. Your contribution will help other users.

        Reply
    14. Amr Farouk on February 19, 2020 4:56 am

      I double Marco’s opinion.
      this is the best tutorial among at least 15 I went through.
      and by far as well

      Reply
    15. ThumbOne on August 8, 2019 10:59 am

      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.

      Reply
    16. Ron on March 26, 2019 6:10 pm

      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.

      Reply
    17. ron on March 25, 2019 8:54 pm

      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.

      Reply
    18. caisy on January 8, 2019 1:55 am

      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

      Reply
      • Mark R. on January 22, 2019 4:27 pm

        This was very helpful and work great. Thanks!

        Reply
      • Ryan on February 10, 2019 2:39 am

        Awesome, this worked perfectly for me. Thank you very much.

        Reply
      • Jacky Woo on February 23, 2019 9:02 am

        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

        Reply
        • cr on October 2, 2019 10:52 am

          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.

          Reply
      • Uncle Mike on May 19, 2019 5:27 pm

        Thank you Caisy, and of course thanks to Rahul

        Reply
      • MattG on December 10, 2019 10:31 pm

        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

        Reply
        • Javier on March 13, 2020 8:58 am

          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.

          Reply
        • Martins on January 19, 2021 12:06 pm

          Adding User and Group fixed it for me as well.

          Reply
          • Fs on January 12, 2022 11:07 pm

            USER and GROUP, there you go! thx!

            Reply
      • roland albert roth on March 1, 2020 4:09 pm

        Thank you MATTG
        With your detail and explanation its working well (LunixMint 19.3)
        roland

        Reply
      • Mark on August 15, 2020 8:46 pm

        This worked for me as well on Linux Mint 20, awesome!

        Reply
      • Darryl Kim on April 16, 2021 11:04 pm

        Hello,

        This worked for me on Ubuntu 20.04.2 LTS.
        Thank you! You rock Caisy!

        Reply
    19. Marco on January 7, 2019 8:06 pm

      Thank you, after many tutorial, this work immediately with x11vnc. great!

      Reply
    20. Scott on November 11, 2018 4:57 am

      I’ve followed the instructions herein and continue to receive the error message…’password check failed’. Suggestions?

      Reply
      • Andrei P on December 27, 2018 12:25 am

        Hey, replace the command with the right username 😉

        Reply
    21. batmunkh on January 16, 2018 7:33 am

      autostart isn’t working. have you checked autostart?

      Reply
      • Jonas on December 13, 2018 11:01 am

        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?

        Reply
    22. mark on October 1, 2017 12:49 pm

      you are a time and energy saver.thanks it worked

      Reply
    23. Ranjith Kumar on May 15, 2017 9:09 am

      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??

      Reply
      • Rahul K. on May 17, 2017 3:35 am

        Hi Ranjith,

        What error are you getting? Have you tried with vnc viewer application?

        Reply
        • batmunkh on January 16, 2018 7:32 am

          autostart isn’t working. have you checked autostart?

          Reply
      • sravan on July 25, 2017 5:31 pm

        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.

        Reply
    24. Mike Lieberman on May 13, 2016 8:46 am

      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?

      Reply
    25. Zarko on April 17, 2016 4:54 am

      Thanks! Your instructions work!

      Reply
    26. sam on April 14, 2016 4:52 pm

      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 &

      Reply
    27. Wim on February 20, 2016 10:47 am

      Thanks, exactly what I was looking for.

      Reply
    28. Bojangles on November 13, 2015 2:01 pm

      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.

      Reply
    29. Bojangles on November 13, 2015 3:58 am

      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?

      Reply
      • Rahul on November 13, 2015 6:32 am

        Hi,

        Use password you created with “x11vnc -storepasswd” command. System password is bit different than it.

        Reply
        • roland albert roth on March 1, 2020 4:17 pm

          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.

          Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    • sleep Command in Linux with Examples
    • 20 Basic Linux Commands for the Beginners (Recommended)
    • tail Command in Linux with Examples
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.