mac使用vnc遠程登錄ubuntu16.04桌面


應開發需求,需要訪問遠程服務器的桌面,計划使用vnc創建登錄端口,同時使用frp將vnc端口代理出來,實現VNC Viewer訪問遠程桌面。

記錄如下。

1.安裝
在Ubuntu上安裝x11vnc
$ sudo apt-get install x11vnc
2.配置vnc密碼
$ sudo x11vnc -storepasswd   

Enter VNC password: 

Verify password:    

Write password to /home/ubuntu/.vnc/passwd?  [y]/n y

3.啟動vnc服務,默認開啟5900端口.

$ 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,輸入密碼,即可訪問遠程桌面

 

結束。 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM