How to get x11vnc to run at startup on openSuSE 12.1

13,960

Solution 1

Here is what I could find, either should work:


To fix x11vnc:

Enter these commands at a console as the user:

mkdir ~/.vnc
x11vnc -storepasswd "password" ~/.vnc/passwd

Put this in the ~/.x11vncrc file replacing user with your username:

display :0
rfbauth /home/user/.vnc/passwd
forever
bg

Now to autostart it each time the user logs in:

ln -s /usr/bin/x11vnc ~/.kde/Autostart/x11vnc

Now reboot or restart the desktop session.

(src)


YaST:

From the KDE desktop, select the YaST icon, enter the root password, and select OK; then select Network Services > Remote Administration.

Select Allow Remote Administration; then select Finish

(src)

Solution 2

Revert /etc/X11/xdm/Xsetup back to it's original state (remove your edits). This is not being called during system boot.

Add your startup line /usr/bin/x11vnc -rfbauth /usr/bin/vnc/passwd -o /var/log/x11vnc.log -forever -bg to the file /etc/init.d/after.local.

Unless you want write a compliant init script that starts/stops/restarts the x11vnc process (which is possible but beyond the scope of this answer), you should place any processes you want to execute on boot in /etc/init.d/after.local.

Note: On RedHat systems, this would go in rc.local. SUSE uses before.local (execute before the init scripts) and after.local (execute after the init scripts).

Solution 3

I don't have a SuSE 11 install in front of me to check.

Uther's on the right track - but you need to get the program to start AFTER X11 has been started.

I don't know for sure if it CAN work if just X is running - would you WANT it to be run if, for example, "guest" logged in via the X-window login screen?

With 12, SuSE changes all of the startup script stuff, so you may just want to upgrade, then fix it on 12:

http://news.opensuse.org/2011/12/22/systemd-%E2%80%93-boot-faster-and-cleaner-with-opensuse-12-1/

As a general goal, you'll want to figure out what's actually running as your "login screen" under X (probably gdm - http://projects.gnome.org/gdm/ ) and how that got fired up. Wherever it's getting run, you'll want to run your x11vnc either directly before or directly after that.

Share:
13,960

Related videos on Youtube

Mike Christensen
Author by

Mike Christensen

Updated on September 18, 2022

Comments

  • Mike Christensen
    Mike Christensen over 1 year

    I'm trying to get x11vnc to run at startup with openSuse but not having much luck. Here's what I did so far.

    I edited /etc/X11/xdm/Xsetup and added the following lines to the end, right before exit 0:

    #run x11vnc automatically
    /usr/bin/x11vnc -rfbauth /usr/bin/vnc/passwd -o /var/log/x11vnc.log -forever -bg
    

    I created the `/usr/bin/vnc/passwd file using:

    sudo x11vnc -storepasswd /usr/bin/vnc/passwd
    

    When I reboot, I do a ps -A | grep x11 and do not see the process running. I also see no /var/log/x11vnc.log file created. I can run the command from bash directory and it works fine. I have a feeling this script is never getting run at startup.

    I also created a new file called /etc/kde4/kdm/Xsetup and put the two lines from above in there, and same behavior.

    The file permissions are:

    -rw------- 1 root root 8 Apr 26 22:26 /usr/bin/vnc/passwd
    -rwxr-xr-x 1 root root 5691 Apr 26 22:01 /etc/X11/xdm/Xsetup
    

    Any ideas?

    UPDATE

    I've even tried just echo'ing Hello World to a text file in Xsetup which also does nothing. It seems this script simply doesn't get run at boot.

    UPDATE 2:

    I upgraded to 12.1, however none of my attempts have worked either.

    • user1055604
      user1055604 almost 12 years
      i have a few questions if you dont mind: 1. what display manager are u running (KDM or GDM) 2. is there a particular reason for preference to x11vnc over the default vnc server of your distribution 3. best i know, vnc allows you to share a desktop after login and not the login session itself, is that sufficient for you... thanks...
    • Mike Christensen
      Mike Christensen almost 12 years
      @user1055604 - 1) I'm running KDE. 2) No, x11vnc is just the first one I looked up how to install and get working but I'm fine with any VNC server really and 3) Yes, automatically starting after a logon is fine as well.
    • user1055604
      user1055604 almost 12 years
      thanks... check out my post... hope it solves your problem...
  • Rob
    Rob almost 12 years
    This will start it as the system boots, not when KDE starts.
  • Mike Christensen
    Mike Christensen almost 12 years
    This doesn't work. x11nvc still isn't running at boot and if I look in the logs I see: *** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue. - I'm gonna guess because there's not yet a valid display to bind to when after.local gets run?
  • Mike Christensen
    Mike Christensen almost 12 years
    Full log: pastie.org/3851743
  • Mike Christensen
    Mike Christensen almost 12 years
    Thanks! I've upgraded to 12 (I was meaning to anyway), but still I can't seem to find a script that actually gets run after X starts..
  • George M
    George M almost 12 years
    For clarification, X is running on this host, right? You have a graphical login screen and desktop?
  • pbr
    pbr almost 12 years
    I don't think you'll find one. You'll want to chase the scripts that are STARTING X - look for whatever's running GDM. Once you find it, you can either (a) call your script and be done, or (b) code a generic "hook" that runs some after-x-starts.sh script if it exists, and submit that change back to the project.
  • Mike Christensen
    Mike Christensen almost 12 years
    @uther - Yes, default openSuse 12.1 install with a KDE desktop.. Nothing too special about it..
  • Mike Christensen
    Mike Christensen almost 12 years
    This looks promising, I will try this later on today!
  • Mike Christensen
    Mike Christensen almost 12 years
    Tried both, neither work.. I did notice Autostart didn't exist, so I created it first. But x11vnc does not start at logon. Allow Remote Administration was already on this whole time, however it has no effect. Still can't VNC into the box. Thanks for trying though!
  • Mike Christensen
    Mike Christensen almost 12 years
    Ok I have no idea why this doesn't work, all the docs say it will. However, the .x11vncrc file seemed to help a lot. I found a method involving creating a file in ~/.config/autostart which finally works combined with your first step. I think this answer is probably the best out of the bunch though. Thanks!
  • user1055604
    user1055604 almost 12 years
    .config/autostart is the new place where both KDE and Gnome look for their autostart files, in the .desktop format... the src i used was really old... good to know it worked out...