應開發需求,需要訪問遠程服務器的桌面,計划使用vnc創建登錄端口,同時使用frp將vnc端口代理出來,實現VNC Viewer訪問遠程桌面。
記錄如下。
Enter VNC password:
Verify password:
Write password to /home/ubuntu/.vnc/passwd? [y]/n y
$ sudo x11vnc -forever -shared -rfbauth ~/.vnc/passwd
01/04/2020 16:28:39 passing arg to libvncserver: -rfbauth
01/04/2020 16:28:39 passing arg to libvncserver: /home/ubuntu/.vnc/passwd
01/04/2020 16:28:39 x11vnc version: 0.9.13 lastmod: 2011-08-10 pid: 46912
01/04/2020 16:28:39 XOpenDisplay("") failed.
01/04/2020 16:28:39 Trying again with XAUTHLOCALHOSTNAME=localhost ...
01/04/2020 16:28:39
01/04/2020 16:28:39 *** XOpenDisplay failed. No -display or DISPLAY.
01/04/2020 16:28:39 *** Trying ":0" in 4 seconds. Press Ctrl-C to abort.
01/04/2020 16:28:39 *** 1 2 3 4
01/04/2020 16:28:43 *** XOpenDisplay of ":0" successful.
......
The VNC desktop is: ubuntu: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 ...
4.使用frpc客戶端將5900端口映射到外網
$ cat frpc.ini
......
[vnc234server]
type = tcp
local_ip = 127.0.0.1
local_port = 5900 #vnc端口
remote_port = 20052 #映射的frp公網端口
5.在mac上安裝vnc viewer,在菜單里填上frp域名:20052,然后點擊OK,輸入密碼,即可訪問遠程桌面
結束。