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,输入密码,即可访问远程桌面

 

结束。 

 

 

posted @ 2020-04-01 22:29  巴州夜雨  阅读(1653)  评论(0编辑  收藏  举报