How to Have a true Remote Desktop on Linux / Fedora 25 VNC

Remote Desktop Icon

 25,340 total views,  7 views today

Remote Desktop on Linux with VNC




There are different ways to have remote desktops on linux. 

I did not want separate VNC sessions, I wanted a true / shared desktop. I needed a way to show whatever is on my screens to the  client.

I also wanted it to start on boot with no intervention, and restart if it dies, so that no matter where I am I can always connect to my desktop.

I have done this with multiple Fedora versions, and it will likely work on other distros maybe with a little tweaks.

Depending on what display manager you use, and what distro you use, this may not work out of the box. 

This will work out of the box on Fedora 25 with LightDM, KDM, GDM, XDM, and SDDM. 

It will work on older Fedora versions using LightDM and SDDM, but might require some tweaks for other display managers.

If you need help getting it to work for your Distro just ask, and if you have a better way to do this, please comment!


  1. Install x11vnc and tigervnc-server
  2. Create a systemd service file to start on boot
  3. Create x11vnc startup script
  4. Create x11vnc password file
  5. Enable service


Step 1: Install x11vnc and tigervnc-server

sudo dnf install x11vnc tigervnc-server


Step 2: Create a systemd service file to start on boot

Create a file : /usr/lib/systemd/system/x11vnc.service and put the following :



Step 3: Create a x11vnc startup script

Create a file : /root/X11vnc_init and put the following :


if($ARGV[0] eq "stop"){system("killall -9 x11vnc"); exit 0;}
$LIGHT=`pgrep -x lightdm`; chomp $LIGHT;
print "Found Lightdm Display manager\n";
goto nextstep;
$KDM=`pgrep -x kdm`; chomp $KDM;
print "Found KDM Display manager\n";
goto nextstep;
$GDM=`pgrep -x gdm`; chomp $GDM;
$dm=`ps ax |grep gdm |grep \\\\-auth |grep -v grep`;chomp $dm;
($junk1,$junk2)=split(/-auth /,$dm);
($junk3,$junk4)=split(/\/gdm\/Xauthority /,$junk2);
print "Found GDM Display manager with authfile $authfile\n";
goto nextstep;
$XDM=`pgrep -x xdm`; chomp $XDM;
$dm=`ps ax |grep xdm |grep authdir |grep -v grep`; chomp $dm;
print "Found XDM Display manager with authfile $authfile\n";
goto nextstep;
$SDDM=`pgrep -x sddm`; chomp $SDDM;
$dm=`ps ax |grep sddm |grep var/run |grep -v grep`; chomp $dm;
print "Found SDDM Display manager with authfile $authfile\n";
goto nextstep;
if($DM eq "gdm"){$AUTH="-auth $authfile";}
if($DM eq "lightdm"){ $AUTH="-auth /var/run/lightdm/root/:0 ";}
if($DM eq "kdm" ){ $AUTH="-auth guess ";}
if($DM eq "xdm" || $DM eq "sddm"){$AUTH="-auth $authfile ";}
print "NO Compatible dm found\n";
exit 0;
my $pid = fork();
$XCMD="/usr/bin/x11vnc \
-rfbauth /root/x11vncpasswd \
-nap -many -norepeat 5 -alwaysshared -dontdisconnect \
-shared -nolookup \
-rfbport 5900 -no6 -xkb -display :0 &";
$XCMD=~s/\n/ /gm;
open tmpsh,">/tmp/";
print tmpsh "#!/bin/bash
sleep 10;
close tmpsh;
system("chmod 755 /tmp/");
system("/tmp/ &");
exit 0;

Step 4 : Create a VNC Password file

Run the command : vncpasswd /root/x11vncpasswd

Type and Verify the password you want your client to use to connect to the desktop.

Step 5: Enable the service and reboot

systemctl enable x11vnc


Now you can either run: systemctl start x11vnc and the service should start, or you can reboot to make sure it works right.

When your having problems and x11vnc is not running , run the script from the shell so you can see the output. : /root/X11vnc_init

If you still cant get it to work, leave a comment or email me on facebook and I will help you out. 

Related posts

4 thoughts on “How to Have a true Remote Desktop on Linux / Fedora 25 VNC

  1. tadalafil 20 mg

    Amazing lots of amazing information.

  2. cialis generico online

    Incredible a good deal of valuable information.

  3. Hi Ryan,
    I am having trouble setting up x11vnc. I am getting error enabling service.
    systemctl enable x11vnc
    Failed to enable unit: Invalid argument


    1. Run the script as root from the commands line and see the output /root/X11vnc_init