LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Attach X11Vnc to X? (https://www.linuxquestions.org/questions/linux-server-73/attach-x11vnc-to-x-941962/)

eqtime 04-26-2012 05:41 PM

Attach X11Vnc to X?
 
I'm using CentOS 6.2.

From Windows I can connect to my Linux server running X11Vnc server fine running the command x11vnc -forever -bg.

What I want to do is make the automatically available after a reboot without having to run the command. I have edited rc.local with command but it's not working.

In the log it has ***X11vnc was unable to Open the X DISPLAY ":0", it cannot continue

Any help would be appreciated.

krunge 04-27-2012 09:47 AM

x11vnc needs to be started after the X server starts.

It also needs do be directed at the display, usually :0, with the the correct xauthority credentials.

Usually this is done with the display manager start up script,e.g. gdm Init Default.

But your rc local script may work if you simply have x11vnc wait for a period of time before starting. Try an x11vnc cmdline option '-sleepin 60' to have it wait 60 secs.

eqtime 04-27-2012 06:03 PM

Thank you for the reply. I will test that out when I get the chance.

From the log it auto attempts to use -display :0, but fails, I'm guessing this is because I was trying to execute it before X started, but likely wouldn't have worked anyway because authority credentials were being omitted?

I had edited Default file (I'm using gdm) with the same command but it didn't seem to run. I also added KillInitClients=false to the custom.conf in gdm directory.

krunge 04-28-2012 11:14 AM

Traditionally, a process running as root would need to supply the same credentials to the X server as anyone else would. But in recent years a feature in the X server has been enabled that allows a process (X client) running as root on the same machine to be let in for free. So your rc.local scheme may work if you just sleep for a bit before trying to connect to the X server (or try indefinitely in a loop.) I've seen people start x11vnc out of the init.d scripts so it works as long as the X server is running before x11vnc is run. If you have trouble collect log file (see below.)

For the gdm method add something like -o /var/log/x11vnc.log to the x11vnc cmdline and examine the error messages. If that log file does not get created then see if it is being run at all, e.g. put the command "touch /tmp/im_here" in gdm file and see if the flag file is created.

eqtime 04-29-2012 07:33 PM

Putting in -sleepin 60 didn't work unfortunately :(

This is what I have in my /etc/gdm/Init/Default - /usr/bin/x11vnc -rfbauth $HOME/.vnc/passwd -auth /var/gdm/:0.Xauth -display :0 -forever -bg -o /var/log/x11vnc.log

Do I need both -auth and -rfbauth?

Still giving me the following message in the log ***X11vnc was unable to Open the X DISPLAY ":0".

Is there something I'm missing?

krunge 04-29-2012 11:13 PM

Hi, for gdm Init Default neither "-auth" nor "-display" are needed, so I suggest dropping them from the cmdline (gdm sets the DISPLAY and XAUTHORITY env. vars correctly so why potentially change them?)

-rfbauth is needed for a VNC password. Not needed for testing.

eqtime 04-30-2012 04:08 PM

THanks, I've removed those and just left it as x11vnc -bg -forever -o /var/log/x11vnc.log

I've added that command into gdm right before the x11vnc command, this was the output:, which looks pretty normal.

Code:

user          1825  0.0  0.1 143444  2848 ?        S    08:53  0:00 /usr/libexec/gvfs-gdu-volume-monitor
user          1827  0.0  0.3 252216  6672 ?        S    08:53  0:00 gnome-power-manager
user          1830  0.1  0.4 253212 10040 ?        S    08:53  0:00 /usr/libexec/polkit-gnome-authentication-agent-1
user          1832  0.0  0.3 249792  6420 ?        S    08:53  0:00 /usr/libexec/gdu-notification-daemon
user          1834  0.1  0.3 275940  8012 ?        S    08:53  0:00 gpk-update-icon
root          1835  0.1  0.1  40588  2592 ?        S    08:53  0:00 /usr/libexec/udisks-daemon
user          1836  0.0  0.3 255300  7904 ?        S    08:53  0:00 bluetooth-applet
user          1838  0.1  0.4 351592  9604 ?        S    08:53  0:00 gnome-volume-control-applet
root          1846  0.0  0.0  40328  556 ?        S    08:53  0:00 udisks-daemon: not polling any devices
user          1851  0.0  0.1 141212  2780 ?        S    08:53  0:00 /usr/libexec/gvfsd-trash --spawner :1.8 /org/gtk/gvfs/exec_spaw/0
root          1859  0.1  0.1  76936  3940 ?        S    08:53  0:00 /usr/sbin/packagekitd
user          1861  0.0  0.1 258492  2500 ?        Ss  08:53  0:00 gnome-screensaver
user          1866  0.0  0.0 231896  2000 ?        Sl  08:53  0:00 /usr/libexec/gvfs-afc-volume-monitor
user          1871  0.0  0.1 148092  2064 ?        S    08:53  0:00 /usr/libexec/gvfs-gphoto2-volume-monitor
user          1881  0.2  0.6 459744 13128 ?        S    08:53  0:00 /usr/libexec/clock-applet --oaf-activate-iid=OAFIID:GNOME_ClockApplet_Factory --oaf-ior-fd=30
user          1882  0.1  0.5 386772 10844 ?        S    08:53  0:00 /usr/libexec/gdm-user-switch-applet --oaf-activate-iid=OAFIID:GNOME_FastUserSwitchApplet_Factory$
user          1883  0.0  0.3 285000  7568 ?        S    08:53  0:00 /usr/libexec/notification-area-applet --oaf-activate-iid=OAFIID:GNOME_NotificationAreaApplet_Fac$
root          1888  0.0  0.1  69824  2260 ?        S    08:53  0:00 /usr/libexec/polkit-1/polkit-agent-helper-1 root cookie0
user          1902  0.0  0.1 134584  2128 ?        S    08:53  0:00 /usr/libexec/gvfsd-burn --spawner :1.8 /org/gtk/gvfs/exec_spaw/1
root          1903  0.0  0.0  21424  472 ?        Ss  08:53  0:00 /usr/sbin/atd
root          1919  2.2  0.1 121468  2136 ?        Ss  08:55  0:00 /usr/sbin/gdm-binary -nodaemon
root          1924  0.5  0.0  4048  536 tty2    Ss+  08:55  0:00 /sbin/mingetty /dev/tty2
root          1926  0.0  0.0  4048  536 tty3    Ss+  08:55  0:00 /sbin/mingetty /dev/tty3
root          1928  0.0  0.0  4048  536 tty4    Ss+  08:55  0:00 /sbin/mingetty /dev/tty4
root          1932  0.0  0.1  12468  2656 ?        S<  08:55  0:00 /sbin/udevd -d
root          1933  0.0  0.1  12468  2656 ?        S<  08:55  0:00 /sbin/udevd -d
root          1934  0.0  0.0  4048  532 tty5    Ss+  08:55  0:00 /sbin/mingetty /dev/tty5
root          1936  0.3  0.0  4048  540 tty6    Ss+  08:55  0:00 /sbin/mingetty /dev/tty6
root          1951  1.3  0.1 152016  2852 ?        S    08:55  0:00 /usr/libexec/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1 --force-active-vt
root          1953 70.6  0.7 111808 15156 tty1    Ss+  08:55  0:02 /usr/bin/Xorg :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-LaB4hy/database vt1
root          1968  0.0  0.0  9216  496 ?        S    08:55  0:00 /bin/sh /etc/gdm/Init/Default
root          1970  0.0  0.0  13360  1016 ?        R    08:55  0:00 ps wwaux


krunge 04-30-2012 11:11 PM

Yes, that looks just like we expect. What's in the x11vnc.log? If x11vnc is still not working, post the x11vnc.log file here.

eqtime 04-30-2012 11:41 PM

It's working !!! I think there may have been a conflict with my rc.local and gdm using the command in both, at least in terms of logging. I removed the command from rc.local and it was logged that it was getting permission denied on listening port. This is from SELinux which I've edited to disabled.

Thanks for the help on this krunge!


All times are GMT -5. The time now is 03:05 PM.