x11vnc 출력을 제거할 수 없습니다

x11vnc 출력을 제거할 수 없습니다

저는 디스플레이에 터치 스크린이 설정된 Ubuntu 시스템을 사용하고 있습니다: 0. Windows에서 터치스크린을 원격으로 제어할 수 있기를 원해서 x11vnc를 설정했습니다. 좋은 결과. 하지만 설정은 다음과 같습니다.

두 명의 사용자가 있습니다(루트 제외). 터치스크린에 자동으로 로그인하는 제한된 사용자(기본적으로 권한 및 비밀번호 없음)와 복잡한 비밀번호, sudo 권한 등을 가진 완전히 프로비저닝된 사용자입니다. 제한된 사용자가 로그인했을 때(터치스크린이 활성화될 때) x11vnc를 실행하는 것에만 관심이 있으므로 x11vnc -loop &파일 끝에 명령을 넣었습니다 /home/restricted/.profile. 잘 작동합니다. 그러나 해당 사용자는 나중에 다른 명령을 실행해야 하기 때문에 백그라운드 프로세스여야 합니다(사람 사용자에게는 숨겨짐).

내가 겪고 있는 문제는 x11vnc의 출력이 매우 시끄럽다는 것입니다. 특히 비밀번호를 사용하지 않고(저는 사용하지 않습니다) 루프이므로 계속 반복됩니다. 일반적으로 이것은 문제가 되지 않지만 출력을 /dev/null 로 리디렉션하는 것은 작동하지 않을 뿐만 아니라(아래 설명 참조) ssh를 통해 로그인하면 출력이 다른 사용자의 터미널에 나타납니다(실제로는 매우 짜증납니다). , 유지 관리를 위해 해당 계정을 사용하고 화면이 일부 백그라운드 프로세스의 출력으로 가득 차면 아무것도 할 수 없기 때문에 다음은 내가 얻는 출력의 예입니다.

--- x11vnc loop: 1 ---

--- x11vnc loop: waiting for: 1551

###############################################################
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
#@                                                           @#
#@  **  WARNING  **  WARNING  **  WARNING  **  WARNING  **   @#
#@                                                           @#
#@        YOU ARE RUNNING X11VNC WITHOUT A PASSWORD!!        @#
#@                                                           @#
#@  This means anyone with network access to this computer   @#
#@  may be able to view and control your desktop.            @#
#@                                                           @#
#@ >>> If you did not mean to do this Press CTRL-C now!! <<< @#
#@                                                           @#
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
#@                                                           @#
#@  You can create an x11vnc password file by running:       @#
#@                                                           @#
#@       x11vnc -storepasswd password /path/to/passfile      @#
#@  or   x11vnc -storepasswd /path/to/passfile               @#
#@  or   x11vnc -storepasswd                                 @#
#@                                                           @#
#@  (the last one will use ~/.vnc/passwd)                    @#
#@                                                           @#
#@  and then starting x11vnc via:                            @#
#@                                                           @#
#@      x11vnc -rfbauth /path/to/passfile                    @#
#@                                                           @#
#@  an existing ~/.vnc/passwd file from another VNC          @#
#@  application will work fine too.                          @#
#@                                                           @#
#@  You can also use the -passwdfile or -passwd options.     @#
#@  (note -passwd is unsafe if local users are not trusted)  @#
#@                                                           @#
#@  Make sure any -rfbauth and -passwdfile password files    @#
#@  cannot be read by untrusted users.                       @#
#@                                                           @#
#@  Use x11vnc -usepw to automatically use your              @#
#@  ~/.vnc/passwd or ~/.vnc/passwdfile password files.       @#
#@  (and prompt you to create ~/.vnc/passwd if neither       @#
#@  file exists.)  Under -usepw, x11vnc will exit if it      @#
#@  cannot find a password to use.                           @#
#@                                                           @#
#@                                                           @#
#@  Even with a password, the subsequent VNC traffic is      @#
#@  sent in the clear.  Consider tunnelling via ssh(1):      @#
#@                                                           @#
#@    http://www.karlrunge.com/x11vnc/#tunnelling            @#
#@                                                           @#
#@  Or using the x11vnc SSL options: -ssl and -stunnel       @#
#@                                                           @#
#@  Please Read the documention for more info about          @#
#@  passwords, security, and encryption.                     @#
#@                                                           @#
#@    http://www.karlrunge.com/x11vnc/faq.html#faq-passwd    @#
#@                                                           @#
#@  To disable this warning use the -nopw option, or put     @#
#@  'nopw' on a line in your ~/.x11vncrc file.               @#
#@                                                           @#
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
###############################################################
20/05/2016 10:53:18 x11vnc version: 0.9.13 lastmod: 2011-08-10  pid: 1551
20/05/2016 10:53:18 XOpenDisplay("") failed.
20/05/2016 10:53:18 Trying again with XAUTHLOCALHOSTNAME=localhost ...
20/05/2016 10:53:18
20/05/2016 10:53:18 *** XOpenDisplay failed. No -display or DISPLAY.
20/05/2016 10:53:18 *** Trying ":0" in 4 seconds.  Press Ctrl-C to abort.
20/05/2016 10:53:18 *** 1 2 3 4
Invalid MIT-MAGIC-COOKIE-1 key20/05/2016 10:53:22 XOpenDisplay(":0") failed.
20/05/2016 10:53:22 Trying again with XAUTHLOCALHOSTNAME=localhost ...
Invalid MIT-MAGIC-COOKIE-1 key20/05/2016 10:53:22 XOpenDisplay(":0") failed.
20/05/2016 10:53:22 Trying again with unset XAUTHLOCALHOSTNAME ...
Invalid MIT-MAGIC-COOKIE-1 key20/05/2016 10:53:22

20/05/2016 10:53:22 ***************************************
20/05/2016 10:53:22 *** XOpenDisplay failed (:0)

*** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.
*** There may be "Xlib:" error messages above with details about the failure.

Some tips and guidelines:

** An X server (the one you wish to view) must be running before x11vnc is
   started: x11vnc does not start the X server.  (however, see the -create
   option if that is what you really want).

** You must use -display <disp>, -OR- set and export your $DISPLAY
   environment variable to refer to the display of the desired X server.
 - Usually the display is simply ":0" (in fact x11vnc uses this if you forget
   to specify it), but in some multi-user situations it could be ":1", ":2",
   or even ":137".  Ask your administrator or a guru if you are having
   difficulty determining what your X DISPLAY is.

** Next, you need to have sufficient permissions (Xauthority)
   to connect to the X DISPLAY.   Here are some Tips:

 - Often, you just need to run x11vnc as the user logged into the X session.
   So make sure to be that user when you type x11vnc.
 - Being root is usually not enough because the incorrect MIT-MAGIC-COOKIE
   file may be accessed.  The cookie file contains the secret key that
   allows x11vnc to connect to the desired X DISPLAY.
 - You can explicitly indicate which MIT-MAGIC-COOKIE file should be used
   by the -auth option, e.g.:
       x11vnc -auth /home/someuser/.Xauthority -display :0
       x11vnc -auth /tmp/.gdmzndVlR -display :0
   you must have read permission for the auth file.
   See also '-auth guess' and '-findauth' discussed below.

** If NO ONE is logged into an X session yet, but there is a greeter login
   program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need
   to find and use the raw display manager MIT-MAGIC-COOKIE file.
   Some examples for various display managers:

     gdm:     -auth /var/gdm/:0.Xauth
              -auth /var/lib/gdm/:0.Xauth
     kdm:     -auth /var/lib/kdm/A:0-crWk72
              -auth /var/run/xauth/A:0-crWk72
     xdm:     -auth /var/lib/xdm/authdir/authfiles/A:0-XQvaJk
     dtlogin: -auth /var/dt/A:0-UgaaXa

   Sometimes the command "ps wwwwaux | grep auth" can reveal the file location.

   Starting with x11vnc 0.9.9 you can have it try to guess by using:

              -auth guess

   (see also the x11vnc -findauth option.)

   Only root will have read permission for the file, and so x11vnc must be run
   as root (or copy it).  The random characters in the filenames will of course
   change and the directory the cookie file resides in is system dependent.

See also: http://www.karlrunge.com/x11vnc/faq.html

 --- x11vnc loop: sleeping 2000 ms ---


 --- x11vnc loop: 2 ---

계속 반복될 뿐입니다.

디스플레이를 켤 수 없다고 소리지르지만 작동합니다. 제한된 사용자가 이미 이 명령을 실행하고 연결했지만 이제 해당 사용자도 동일한 작업을 시도하고 연결할 수 없기 때문인 것 같습니다.

왜 이런 일이 발생합니까? 분명히 내 이해에는 몇 가지 구멍이 있습니다. 내가 시도한 다양한 접근 방식은 다음과 같습니다.


출력을 /dev/null로 리디렉션

같은 위치에서 /home/restricted/.profile기존 명령 x11vnc -loop &x11vnc -loop > /dev/null 2>&1 &.

이는 아무런 영향을 미치지 않으며 출력은 여전히 ​​다른 사용자의 터미널에 있으며 (분명히) 사라지지 않습니다.


nohup을 사용하여 명령 실행

다시 에서 /home/restricted/.profile기존 명령 x11vnc -loop &nohup x11vnc -loop &.

이번에도 전혀 효과가 없습니다. 출력은 여전히 ​​​​존재합니다. Nohup은 nohup.out 파일도 생성하지 않습니다. 적어도 나는 그것을 찾지 못했습니다.

마무리하기 위해 다시 시도했지만 nohup x11vnc -loop > /dev/null 2>&1 &아무런 변화가 없었습니다.


x11vnc를 데몬으로 시작

여기서 나는 내가 뭘 잘못하고 있는지 깨닫기 시작했습니다. 아마도 /home/restricted/.profile이런 것이 잘못 배치되었기 때문이 아닐까 생각했습니다 . 그래서 시작 시 실행되는 스크립트를 만들어서 /etc/init.d프레임워크 파일의 예시를 따라 연결했습니다.update-rc.d

x11vnc가 다시 작동하지만 모든 터미널에 출력이 나타납니다.


화면에서 x11vnc 시작

이 문제를 해결하기 위한 마지막 시도는 명령을 스크린 세션에 넣는 것이었습니다. Screen은 일반적으로 이와 같은 문제를 해결하지만 이번에는 그렇지 않습니다.

에서는 다음 으로 /home/restricted/.profile대체합니다.x11vnc -loop &screen -d -R x11vnc x11vnc -loop

이번에는 x11vnc가 더 이상 작동하지 않지만(Windows 클라이언트를 통해 연결할 수 없음) 모든 터미널에 여전히 출력이 있습니다.


다시 말하지만, 분명히 x11vnc 또는 부팅 시 프로세스 생성에 대한 내용을 이해하지 못합니다.

위에서 알 수 있듯이 저는 한동안 이 문제를 해결해 왔지만 웹에서 이와 관련된 다른 내용을 찾을 수 없습니다. 그러니 여기서 도움을 주시면 좋을 것 같습니다. 미리 감사드립니다.

답변1

출력 리디렉션이 >&저에게 효과적입니다.

x11vnc -repeat -noxdamage -ncache 10 -forever -loop -rfbauth &> x11vnc.log

관련 정보