LINUX.ORG.RU

История изменений

Исправление sunny1983, (текущая версия) :

Все правильно говорят, первые два пункта делай через автостарт, а для третьего юнит.

С первыми двумя пунктами всё срослось через автостарт.
С третьим пока не срастется.
Вот я создаю юнит /etc/systemd/system/x11vnc.service:

[Unit]
Description=VNC-server x11vnc
Requires=lightdm.service

[Service]
Type=forking
ExecStart=/usr/bin/x11vnc -display :0 -rfbport 5904 -q
User=iskatel
Group=iskatel

[Install]
WantedBy=graphical.target
В journalctl пишет следующее:
июл 20 15:33:13 adm-station systemd[1]: Starting VNC-server x11vnc...
июл 20 15:33:17 adm-station x11vnc[566]: ###############################################################
июл 20 15:33:17 adm-station x11vnc[566]: #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@  **  WARNING  **  WARNING  **  WARNING  **  WARNING  **   @#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@        YOU ARE RUNNING X11VNC WITHOUT A PASSWORD!!        @#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@  This means anyone with network access to this computer   @#
июл 20 15:33:17 adm-station x11vnc[566]: #@  may be able to view and control your desktop.            @#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@ >>> If you did not mean to do this Press CTRL-C now!! <<< @#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
июл 20 15:33:17 adm-station x11vnc[566]: ###############################################################
июл 20 15:33:18 adm-station x11vnc[566]: 20/07/2016 15:33:18 ***************************************
июл 20 15:33:18 adm-station x11vnc[566]: 20/07/2016 15:33:18 *** XOpenDisplay failed (:0)
июл 20 15:33:18 adm-station x11vnc[566]: *** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.
июл 20 15:33:18 adm-station x11vnc[566]: *** There may be "Xlib:" error messages above with details about the failure.
июл 20 15:33:18 adm-station x11vnc[566]: Some tips and guidelines:
июл 20 15:33:18 adm-station x11vnc[566]: ** An X server (the one you wish to view) must be running before x11vnc is
июл 20 15:33:18 adm-station x11vnc[566]: started: x11vnc does not start the X server.  (however, see the -create
июл 20 15:33:18 adm-station x11vnc[566]: option if that is what you really want).
июл 20 15:33:18 adm-station x11vnc[566]: ** You must use -display <disp>, -OR- set and export your $DISPLAY
июл 20 15:33:18 adm-station x11vnc[566]: environment variable to refer to the display of the desired X server.
июл 20 15:33:18 adm-station x11vnc[566]: - Usually the display is simply ":0" (in fact x11vnc uses this if you forget
июл 20 15:33:18 adm-station x11vnc[566]: to specify it), but in some multi-user situations it could be ":1", ":2",
июл 20 15:33:18 adm-station x11vnc[566]: or even ":137".  Ask your administrator or a guru if you are having
июл 20 15:33:18 adm-station x11vnc[566]: difficulty determining what your X DISPLAY is.
июл 20 15:33:18 adm-station x11vnc[566]: ** Next, you need to have sufficient permissions (Xauthority)
июл 20 15:33:18 adm-station x11vnc[566]: to connect to the X DISPLAY.   Here are some Tips:
июл 20 15:33:18 adm-station x11vnc[566]: - Often, you just need to run x11vnc as the user logged into the X session.
июл 20 15:33:18 adm-station x11vnc[566]: So make sure to be that user when you type x11vnc.
июл 20 15:33:18 adm-station x11vnc[566]: - Being root is usually not enough because the incorrect MIT-MAGIC-COOKIE
июл 20 15:33:18 adm-station x11vnc[566]: file may be accessed.  The cookie file contains the secret key that
июл 20 15:33:18 adm-station x11vnc[566]: allows x11vnc to connect to the desired X DISPLAY.
июл 20 15:33:18 adm-station x11vnc[566]: - You can explicitly indicate which MIT-MAGIC-COOKIE file should be used
июл 20 15:33:18 adm-station x11vnc[566]: by the -auth option, e.g.:
июл 20 15:33:18 adm-station x11vnc[566]: x11vnc -auth /home/someuser/.Xauthority -display :0
июл 20 15:33:18 adm-station x11vnc[566]: x11vnc -auth /tmp/.gdmzndVlR -display :0
июл 20 15:33:18 adm-station x11vnc[566]: you must have read permission for the auth file.
июл 20 15:33:18 adm-station x11vnc[566]: See also '-auth guess' and '-findauth' discussed below.
июл 20 15:33:18 adm-station x11vnc[566]: ** If NO ONE is logged into an X session yet, but there is a greeter login
июл 20 15:33:18 adm-station x11vnc[566]: program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need
июл 20 15:33:18 adm-station x11vnc[566]: to find and use the raw display manager MIT-MAGIC-COOKIE file.
июл 20 15:33:18 adm-station x11vnc[566]: Some examples for various display managers:
июл 20 15:33:18 adm-station x11vnc[566]: gdm:     -auth /var/gdm/:0.Xauth
июл 20 15:33:18 adm-station x11vnc[566]: -auth /var/lib/gdm/:0.Xauth
июл 20 15:33:18 adm-station x11vnc[566]: kdm:     -auth /var/lib/kdm/A:0-crWk72
июл 20 15:33:18 adm-station x11vnc[566]: -auth /var/run/xauth/A:0-crWk72
июл 20 15:33:18 adm-station systemd[1]: x11vnc.service: Control process exited, code=exited status=1
июл 20 15:33:18 adm-station systemd[1]: Failed to start VNC-server x11vnc.
июл 20 15:33:18 adm-station systemd[1]: x11vnc.service: Unit entered failed state.
июл 20 15:33:18 adm-station systemd[1]: x11vnc.service: Failed with result 'exit-code'.

Исходная версия sunny1983, :

Все правильно говорят, первые два пункта делай через автостарт, а для третьего юнит.

С первыми двумя пунктами всё срослось через автостарт.
С третьим пока не срастется Я думал подскажут, а то, стыдно признаться, забыл как юниты пишутся. Вот я создаю юнит /etc/systemd/system/x11vnc.service, запускаться он должен, когда запущены иксы, стало быть нужно:

[Unit]
Description=VNC-server x11vnc
Requires=lightdm.service

[Service]
Type=forking
ExecStart=/usr/bin/x11vnc -display :0 -rfbport 5904 -q
User=iskatel
Group=iskatel

[Install]
WantedBy=graphical.target
В journalctl пишет следующее:
июл 20 15:33:13 adm-station systemd[1]: Starting VNC-server x11vnc...
июл 20 15:33:17 adm-station x11vnc[566]: ###############################################################
июл 20 15:33:17 adm-station x11vnc[566]: #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@  **  WARNING  **  WARNING  **  WARNING  **  WARNING  **   @#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@        YOU ARE RUNNING X11VNC WITHOUT A PASSWORD!!        @#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@  This means anyone with network access to this computer   @#
июл 20 15:33:17 adm-station x11vnc[566]: #@  may be able to view and control your desktop.            @#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@ >>> If you did not mean to do this Press CTRL-C now!! <<< @#
июл 20 15:33:17 adm-station x11vnc[566]: #@                                                           @#
июл 20 15:33:17 adm-station x11vnc[566]: #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
июл 20 15:33:17 adm-station x11vnc[566]: ###############################################################
июл 20 15:33:18 adm-station x11vnc[566]: 20/07/2016 15:33:18 ***************************************
июл 20 15:33:18 adm-station x11vnc[566]: 20/07/2016 15:33:18 *** XOpenDisplay failed (:0)
июл 20 15:33:18 adm-station x11vnc[566]: *** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.
июл 20 15:33:18 adm-station x11vnc[566]: *** There may be "Xlib:" error messages above with details about the failure.
июл 20 15:33:18 adm-station x11vnc[566]: Some tips and guidelines:
июл 20 15:33:18 adm-station x11vnc[566]: ** An X server (the one you wish to view) must be running before x11vnc is
июл 20 15:33:18 adm-station x11vnc[566]: started: x11vnc does not start the X server.  (however, see the -create
июл 20 15:33:18 adm-station x11vnc[566]: option if that is what you really want).
июл 20 15:33:18 adm-station x11vnc[566]: ** You must use -display <disp>, -OR- set and export your $DISPLAY
июл 20 15:33:18 adm-station x11vnc[566]: environment variable to refer to the display of the desired X server.
июл 20 15:33:18 adm-station x11vnc[566]: - Usually the display is simply ":0" (in fact x11vnc uses this if you forget
июл 20 15:33:18 adm-station x11vnc[566]: to specify it), but in some multi-user situations it could be ":1", ":2",
июл 20 15:33:18 adm-station x11vnc[566]: or even ":137".  Ask your administrator or a guru if you are having
июл 20 15:33:18 adm-station x11vnc[566]: difficulty determining what your X DISPLAY is.
июл 20 15:33:18 adm-station x11vnc[566]: ** Next, you need to have sufficient permissions (Xauthority)
июл 20 15:33:18 adm-station x11vnc[566]: to connect to the X DISPLAY.   Here are some Tips:
июл 20 15:33:18 adm-station x11vnc[566]: - Often, you just need to run x11vnc as the user logged into the X session.
июл 20 15:33:18 adm-station x11vnc[566]: So make sure to be that user when you type x11vnc.
июл 20 15:33:18 adm-station x11vnc[566]: - Being root is usually not enough because the incorrect MIT-MAGIC-COOKIE
июл 20 15:33:18 adm-station x11vnc[566]: file may be accessed.  The cookie file contains the secret key that
июл 20 15:33:18 adm-station x11vnc[566]: allows x11vnc to connect to the desired X DISPLAY.
июл 20 15:33:18 adm-station x11vnc[566]: - You can explicitly indicate which MIT-MAGIC-COOKIE file should be used
июл 20 15:33:18 adm-station x11vnc[566]: by the -auth option, e.g.:
июл 20 15:33:18 adm-station x11vnc[566]: x11vnc -auth /home/someuser/.Xauthority -display :0
июл 20 15:33:18 adm-station x11vnc[566]: x11vnc -auth /tmp/.gdmzndVlR -display :0
июл 20 15:33:18 adm-station x11vnc[566]: you must have read permission for the auth file.
июл 20 15:33:18 adm-station x11vnc[566]: See also '-auth guess' and '-findauth' discussed below.
июл 20 15:33:18 adm-station x11vnc[566]: ** If NO ONE is logged into an X session yet, but there is a greeter login
июл 20 15:33:18 adm-station x11vnc[566]: program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need
июл 20 15:33:18 adm-station x11vnc[566]: to find and use the raw display manager MIT-MAGIC-COOKIE file.
июл 20 15:33:18 adm-station x11vnc[566]: Some examples for various display managers:
июл 20 15:33:18 adm-station x11vnc[566]: gdm:     -auth /var/gdm/:0.Xauth
июл 20 15:33:18 adm-station x11vnc[566]: -auth /var/lib/gdm/:0.Xauth
июл 20 15:33:18 adm-station x11vnc[566]: kdm:     -auth /var/lib/kdm/A:0-crWk72
июл 20 15:33:18 adm-station x11vnc[566]: -auth /var/run/xauth/A:0-crWk72
июл 20 15:33:18 adm-station systemd[1]: x11vnc.service: Control process exited, code=exited status=1
июл 20 15:33:18 adm-station systemd[1]: Failed to start VNC-server x11vnc.
июл 20 15:33:18 adm-station systemd[1]: x11vnc.service: Unit entered failed state.
июл 20 15:33:18 adm-station systemd[1]: x11vnc.service: Failed with result 'exit-code'.