最後更新: 7/1/12
介紹
x11vnc 有別於其他 VNC Server, 比如 tightvnc
因為它是在使用 "real X11"的, 意思即是它的 display 是用 physical 的 :0
那正正是大家在 M$ 上的 VNC 效果 !! (Default Linux 上的 VNC 是與 M$ 上的 VNC 有所不同)
應用
在 X 內執行
x11vnc -safer -display :0
又或者用
x11vnc -safer -find -create -findauth
p.s.
-
Default x11vnc 只能連接一次(-once), 意思是當 Client 斷線後, Server 就會立即離開
如果想永遠可以連接, 就要加 "-forever" - -safer 是指 -novncconnect -noremote 及禁止 -gui -connect 的設定
其他有用設定
-shared 可以多個 VNC Client 同時連一個 VNC Server 互動 (default off).
-tightfilexfer Enable the TightVNC file transfer extension.
-localhost 相當於 "-allow 127.0.0.1".
-nopw 沒有 password 去啟動 x11vnc 都沒有 warining
-rfbport str Listen 其他 port, default 是與 display 相同
-passwd plain-password 直接設定 plain pw
-geometry WxH
-loopNNN -loop100 to sleep 100 millisecs between restarts (-loopbg)
-bg
-connect host:port 反向連接
-nolookup
詳細的設定要就要看 6xxx 多行的 man x11vnc
設定密碼
建立 password 檔:
x11vnc -storepasswd ----> ~/.vnc/passwd
用 password 去啟動 x11vnc:
x11vnc -rfbauth ~/.vnc/passfile
相當於
x11vnc -usepw
設定檔
$HOME/.x11vncrc
設定的 "-" 不用加在設定檔內, "#" 係 comments 來, "\" 則是同行
Xauthority
如果不是在 X 內直接執行 x11vnc, 就會有以下 error
08/01/2012 22:53:47 *** XOpenDisplay failed (:0)
原因是x11vnc 沒有 Xauthority, 所以不能與X建立連線 !!
正如它的輸出提示, 用
ps aux | grep auth
Output:
root 993 2.0 1.4 29244 14000 tty7 Ss+ 09:37 6:45 /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none
找出 Xauthority, 然後執行
x11vnc -display :0 -auth /var/run/lightdm/root/:0
SSH tunnel
建立 tunnel
ssh -t -L 5900:localhost:5900 far-host 'x11vnc -localhost -display :0'
-t 在 remote 上建立 pseudo-tty, 比如 tty
其他有用的參數
-grabkbd
-grabptr
當 Viewer 連接後, monitor 前的人不鹿控制
-allow host1[,host2..]
-proxy string