I'm using Centos 6.9, and I've installed Gnome on it. Now I'm trying to use x11vnc to remote control it. The problem is that I want to start the x11vnc without any user login. I've tried creating a service for it, but it failed because it can't find display:0.

So I've created a startup script in /etc/xdg/autostart, but the system seems to not running it.

If I'm trying to run it manually, it works ( awk -F= '/Exec=/{system($2)}' /etc/xdg/autostart/x11vnc.desktop )

This is my script:

[Desktop Entry]
GenericName=Run X11vnc
Comment=Run X11vnc 1

UPDATE To sum it up, thanks to Hermann advice, I was able to finally run it. Another thing that was needed, was that Selinux will allow it to autoprobe tcp for the port. this is the command for it chcon -t xserver_exec_t /usr/bin/x11vnc


It works at the greeter screen, but after the login, it closes the x11vnc process. any ideas?

  • Start x11vnc with the display manager, The gui where you enter your user name and password. What dm are you using? GDM LXDM – jc__ Sep 11 '17 at 14:49
  • The display manager is GDM – yanivhs Sep 11 '17 at 18:15
  • In response to update 2: You may want to take a look at the x11vnc parameter -reopen, provided your binary is recent enough to support it. – Hermann May 25 '18 at 12:23

The contents of /etc/xdg/autostart are executed after a user logs in graphically. You probably want to start x11vnc with the display manager (which invokes the login greeter). Depending on your choice of display manager, you need to modify

  • /etc/gdm/Init/:0 for GDM,
  • /etc/kde4/kdm/Xsetup for KDM,
  • a (new) file /etc/lightdm/lightdm.conf.d/ (actual file varies) for LightDM

. I assume you stick to GDM. Invoke x11vnc with the -auth option. With any luck, x11vnc -auth guess -display :0 & should suffice. Do not forget the ampersand, else the display manager waits for x11vnc to terminate.

For VNC with LightDM, you can try the internal VNC Server configuration section like this:

command=/usr/bin/x11vnc -auth guess -display :0

This content is supposed to go into a new file, e.g. /etc/lightdm/lightdm.conf.d/vncserver.conf.

| improve this answer | |
  • Yes, I want x11vnc to start when the login greeter is displayed. In /etc/gdm/Init, i only have a file named default. Do you mean I should invoke x11vnc from it? – yanivhs Sep 11 '17 at 18:10
  • /etc/gdm/Init/default applies to all desktops (not only :0). So yes, you can launch x11vnc from there. – Hermann Sep 11 '17 at 19:03
  • Well, it try to start but failed, this is the error : *** unrecognized option(s) *** [1] 1, but when I run it manually, it works. this is the command /usr/bin/x11vnc -display :0 -auth /var/run/gdm/$(ls /var/run/gdm | grep $(whoami))/database -forever -o /var/log/x11vnc.log -bg – yanivhs Sep 12 '17 at 15:07
  • ok, figured up the problem, I had 1 at the end of the line, after I've removed it, this error is gone – yanivhs Sep 13 '17 at 7:09
  • 50-disable-log-backup.conf 50-guest-wrapper.conf 50-unity-greeter.conf 50-greeter-wrapper.conf 50-ubuntu.conf 50-xserver-command.conf are the files in lightdm.conf.d/ which one should be edited? I added your x11vnc command to the 50-xserver-command.conf and rebooted a few times with variations... no response at port 5900 (keeps waiting, waiting on the remote vnc client) until I log in to the box physically via the GUI - then a rejected by host occurs on the remote vnc client. – user391339 Feb 23 '18 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.