windows 远程连接Ubuntu18桌面

参考 Ubuntu18.04~Ubuntu22.04安装并配置VNC_ubuntu安装vnc-CSDN博客

1.Ubtuntu 上安装 x11vnc

sudo apt-get install x11vnc -y

设置密码

sudo x11vnc -storepasswd /etc/x11vnc.pass 

如果忘记密码,可以重新执行上述步骤重置密码

sudo systemctl restart x11vnc


安装完x11vnc之后需要给它配置个service,让它可以自动重启。创建service文件。

sudo vim /etc/systemd/system/x11vnc.service

将下面的内容写入上面创建的service文件,并保存。注意这个地方默认都是Ubuntu系统自带的组件,如果你的桌面不是gdm,下面的命令就可能不生效,所以维持操作系统原样就行。

[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth /run/user/1000/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target

配置好service之后还需要手动启动下,或者重启操作系统,这里我们选择手动启动。

sudo systemctl start x11vnc

启动之后去看下状态,如果没有报错就是成功了,可以使用软件测试了。查看状态不需要sudo权限,普通权限就行了。

systemctl status x11vnc

2.windows 上安装 VNC Viewer


输入远程ip,name随便写

---------------------------------

用一段时间,突然连不上了 报错: 

XOpenDisplay(":0") failed.

*** XOpenDisplay failed. No -display or DISPLAY.

systemctl status x11vnc

sudo startx  //启动一个display:

ctrl+z  //放在后台运行  

ps -aux|grep vnc

mobaXterm 登陆后显示

/usr/bin/xauth:  /home/nvidia/.Xauthority not writable, changes will be ignored
MoTTY X11 proxy: Unsupported authorisation protocol
MoTTY X11 proxy: Unsupported authorisation protocol
XCB failed to connect to the X server due to error:1.

参考:mobaXterm 無法打開服務器qt界面_motty x11 proxy: unsupported authorisation protoco-CSDN博客

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值