统信UOS-1070a版本操作-x11vnc和vnc

网络上很多人写统信UOS配置x11vnc和vnc,配置的各种方法都大同小异的,一步步做了就基本可以使用,存在的问题是重启后就又不行了,我把基本配置放到最后了,就说说存在的问题

x11vnc和tigervnc区别
x11vnc可以让远程访问者控制本地的实际显示器,
而tigervnc既可以远程控制实际显示器,还可以控制平行独立于当前物理显示器的虚拟显示器

1、如果控制台上不使用root用户图形化登录进去,执行x11vnc的报错如下:

[root@localhost ~]# x11vnc
###############################################################
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
#@                                                           @#
#@  **  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.               @#
#@                                                           @#
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
###############################################################
04/07/2024 10:23:52 x11vnc version: 0.9.16 lastmod: 2019-01-05  pid: 5489
04/07/2024 10:23:52 XOpenDisplay("") failed.
04/07/2024 10:23:52 Trying again with XAUTHLOCALHOSTNAME=localhost ...
04/07/2024 10:23:52
04/07/2024 10:23:52 *** XOpenDisplay failed. No -display or DISPLAY.
04/07/2024 10:23:52 *** Trying ":0" in 4 seconds.  Press Ctrl-C to abort.
04/07/2024 10:23:52 *** 1 2 3 4
Invalid MIT-MAGIC-COOKIE-1 key04/07/2024 10:23:56 XOpenDisplay(":0") failed.
04/07/2024 10:23:56 Trying again with XAUTHLOCALHOSTNAME=localhost ...
Invalid MIT-MAGIC-COOKIE-1 key04/07/2024 10:23:56 XOpenDisplay(":0") failed.
04/07/2024 10:23:56 Trying again with unset XAUTHLOCALHOSTNAME ...
Invalid MIT-MAGIC-COOKIE-1 key04/07/2024 10:23:56

04/07/2024 10:23:56 ***************************************
04/07/2024 10:23:56 *** 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
[root@localhost ~]#

2、使用root用户图形化登录后执行x11vnc的正常输出如下

[root@localhost ~]# x11vnc
###############################################################
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
#@                                                           @#
#@  **  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.               @#
#@                                                           @#
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
###############################################################
04/07/2024 10:32:43 x11vnc version: 0.9.16 lastmod: 2019-01-05  pid: 4382
04/07/2024 10:32:43 XOpenDisplay("") failed.
04/07/2024 10:32:43 Trying again with XAUTHLOCALHOSTNAME=localhost ...
04/07/2024 10:32:43
04/07/2024 10:32:43 *** XOpenDisplay failed. No -display or DISPLAY.
04/07/2024 10:32:43 *** Trying ":0" in 4 seconds.  Press Ctrl-C to abort.
04/07/2024 10:32:43 *** 1 2 3 4
04/07/2024 10:32:47 *** XOpenDisplay of ":0" successful.
04/07/2024 10:32:47
04/07/2024 10:32:47 Using X display :0
04/07/2024 10:32:47 rootwin: 0x533 reswin: 0x4400001 dpy: 0xeed216f0
04/07/2024 10:32:47
04/07/2024 10:32:47 ------------------ USEFUL INFORMATION ------------------
04/07/2024 10:32:47 X DAMAGE available on display, using it for polling hints.
04/07/2024 10:32:47   To disable this behavior use: '-noxdamage'
04/07/2024 10:32:47
04/07/2024 10:32:47   Most compositing window managers like 'compiz' or 'beryl'
04/07/2024 10:32:47   cause X DAMAGE to fail, and so you may not see any screen
04/07/2024 10:32:47   updates via VNC.  Either disable 'compiz' (recommended) or
04/07/2024 10:32:47   supply the x11vnc '-noxdamage' command line option.
04/07/2024 10:32:47
04/07/2024 10:32:47 Wireframing: -wireframe mode is in effect for window moves.
04/07/2024 10:32:47   If this yields undesired behavior (poor response, painting
04/07/2024 10:32:47   errors, etc) it may be disabled:
04/07/2024 10:32:47    - use '-nowf' to disable wireframing completely.
04/07/2024 10:32:47    - use '-nowcr' to disable the Copy Rectangle after the
04/07/2024 10:32:47      moved window is released in the new position.
04/07/2024 10:32:47   Also see the -help entry for tuning parameters.
04/07/2024 10:32:47   You can press 3 Alt_L's (Left "Alt" key) in a row to
04/07/2024 10:32:47   repaint the screen, also see the -fixscreen option for
04/07/2024 10:32:47   periodic repaints.
04/07/2024 10:32:47
04/07/2024 10:32:47 XFIXES available on display, resetting cursor mode
04/07/2024 10:32:47   to: '-cursor most'.
04/07/2024 10:32:47   to disable this behavior use: '-cursor arrow'
04/07/2024 10:32:47   or '-noxfixes'.
04/07/2024 10:32:47 using XFIXES for cursor drawing.
04/07/2024 10:32:47 GrabServer control via XTEST.
04/07/2024 10:32:47
04/07/2024 10:32:47 Scroll Detection: -scrollcopyrect mode is in effect to
04/07/2024 10:32:47   use RECORD extension to try to detect scrolling windows
04/07/2024 10:32:47   (induced by either user keystroke or mouse input).
04/07/2024 10:32:47   If this yields undesired behavior (poor response, painting
04/07/2024 10:32:47   errors, etc) it may be disabled via: '-noscr'
04/07/2024 10:32:47   Also see the -help entry for tuning parameters.
04/07/2024 10:32:47   You can press 3 Alt_L's (Left "Alt" key) in a row to
04/07/2024 10:32:47   repaint the screen, also see the -fixscreen option for
04/07/2024 10:32:47   periodic repaints.
04/07/2024 10:32:47
04/07/2024 10:32:47 XKEYBOARD: number of keysyms per keycode 7 is greater
04/07/2024 10:32:47   than 4 and 51 keysyms are mapped above 4.
04/07/2024 10:32:47   Automatically switching to -xkb mode.
04/07/2024 10:32:47   If this makes the key mapping worse you can
04/07/2024 10:32:47   disable it with the "-noxkb" option.
04/07/2024 10:32:47   Also, remember "-remap DEAD" for accenting characters.
04/07/2024 10:32:47
04/07/2024 10:32:47 X FBPM extension not supported.
04/07/2024 10:32:47 X display is capable of DPMS.
04/07/2024 10:32:47 --------------------------------------------------------
04/07/2024 10:32:47
04/07/2024 10:32:47 Default visual ID: 0x21
04/07/2024 10:32:47 Read initial data from X display into framebuffer.
04/07/2024 10:32:47 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/4608
04/07/2024 10:32:47
04/07/2024 10:32:47 X display :0 is 32bpp depth=24 true color
04/07/2024 10:32:47
04/07/2024 10:32:47 Autoprobing TCP port
04/07/2024 10:32:47 Autoprobing selected TCP port 5900
04/07/2024 10:32:47 Autoprobing TCP6 port
04/07/2024 10:32:47 Autoprobing selected TCP6 port 5900
04/07/2024 10:32:47 listen6: bind: Address already in use
04/07/2024 10:32:47 Not listening on IPv6 interface.
04/07/2024 10:32:47
04/07/2024 10:32:47 Xinerama is present and active (e.g. multi-head).
04/07/2024 10:32:47 Xinerama: number of sub-screens: 1
04/07/2024 10:32:47 Xinerama: no blackouts needed (only one sub-screen)
04/07/2024 10:32:47
04/07/2024 10:32:47 fb read rate: 756 MB/sec
04/07/2024 10:32:47 fast read: reset -wait  ms to: 10
04/07/2024 10:32:47 fast read: reset -defer ms to: 10
04/07/2024 10:32:47 The X server says there are 10 mouse buttons.
04/07/2024 10:32:47 screen setup finished.
04/07/2024 10:32:47
04/07/2024 10:32:47 WARNING: You are running x11vnc WITHOUT a password.  See
04/07/2024 10:32:47 WARNING: the warning message printed above for more info.
04/07/2024 10:32:47

The VNC desktop is:      localhost.localdomain:0
PORT=5900

******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval.  It should work with any VNC viewer.  Try it by running:

    x11vnc -ncache 10 ...

One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching

04/07/2024 10:32:52 Got connection from client 172.16.55.250
04/07/2024 10:32:52   other clients:
04/07/2024 10:32:52 Normal socket connection
04/07/2024 10:32:52 Disabled X server key autorepeat.
04/07/2024 10:32:52   to force back on run: 'xset r on' (3 times)
04/07/2024 10:32:52 incr accepted_client=1 for 172.16.55.250:51266  sock=10
04/07/2024 10:32:52 Client Protocol Version 3.8
04/07/2024 10:32:52 Protocol version sent 3.8, using 3.8
04/07/2024 10:32:52 Send channel security type 'none'
04/07/2024 10:32:52 rfbProcessClientSecurityType: executing handler for type 1
04/07/2024 10:32:52 rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8
04/07/2024 10:32:52 copy_tiles: allocating first_line at size 37
04/07/2024 10:32:52 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x00000016)
04/07/2024 10:32:52 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x00000015)
04/07/2024 10:32:52 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x0000000F)
04/07/2024 10:32:52 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFEC6)
04/07/2024 10:32:52 Enabling full-color cursor updates for client 172.16.55.250
04/07/2024 10:32:52 Enabling NewFBSize protocol extension for client 172.16.55.250
04/07/2024 10:32:52 Using ZRLE encoding for client 172.16.55.250
04/07/2024 10:32:52 Pixel format for client 172.16.55.250:
04/07/2024 10:32:52   8 bpp, depth 8
04/07/2024 10:32:52   uses a colour map (not true colour).
04/07/2024 10:32:52 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x0000000F)
04/07/2024 10:32:52 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x00000016)
04/07/2024 10:32:52 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x00000015)
04/07/2024 10:32:52 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFEC6)
04/07/2024 10:32:52 Enabling full-color cursor updates for client 172.16.55.250
04/07/2024 10:32:52 Enabling NewFBSize protocol extension for client 172.16.55.250
04/07/2024 10:32:52 Switching from ZRLE to hextile Encoding for client 172.16.55.250
04/07/2024 10:32:52 Pixel format for client 172.16.55.250:
04/07/2024 10:32:52   32 bpp, depth 24, little endian
04/07/2024 10:32:52   true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
04/07/2024 10:32:52 no translation needed
04/07/2024 10:32:52 client 1 network rate 929.5 KB/sec (16883.1 eff KB/sec)
04/07/2024 10:32:52 client 1 latency:  0.5 ms
04/07/2024 10:32:52 dt1: 0.0230, dt2: 0.0363 dt3: 0.0005 bytes: 54818
04/07/2024 10:32:52 link_rate: LR_LAN - 1 ms, 929 KB/s
04/07/2024 10:32:52 client_set_net: 172.16.55.250  0.0026
04/07/2024 10:32:52 created   xdamage object: 0x4400028
04/07/2024 10:33:01 created selwin: 0x4400029
04/07/2024 10:33:01 called initialize_xfixes()
^Ccaught signal: 2
04/07/2024 10:36:38 deleted 36 tile_row polling images.
04/07/2024 10:36:38 Restored X server key autorepeat to: 1
[root@localhost ~]#

基本配置如下

首先安装软件包 #dnf -y install x11vnc
打开终端在命令行执行:x11vnc
设置X11VNC密码  x11vnc -storepasswd /etc/x11vnc.pass

配置VNC服务启动配置文件
vi /lib/systemd/system/x11vnc.service,添加如下内容。
[Unit]
Description=Start x11vnc at startup
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared -ultrafilexfer -bg -o /var/log/x11vnc.log
ExecStop=/usr/bin/killall x11vnc

[Install]
WantedBy=multi-user.target

加载并启动VNC服务
systemctl stop firewalld.service && systemctl disable firewalld.service
systemctl daemon-reload
systemctl enable x11vnc.service && systemctl restart x11vnc.service
systemctl status x11vnc.service

 chmod 755 /lib/systemd/system/x11vnc.service
 chown root:root /lib/systemd/system/x11vnc.service
 
 查看端口 netstat -antlp | grep 5900

tigervnc故障

1、控制台中查看图形化正常,tigervnc登录后无法显示

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值