ubuntu安装vnc启用x11vnc
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>启动Ubuntu的软件中心,选择“X11VNC服务器”,进行安装。当然也可以用sudo apt-get install命令安装。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img style="max-width:100%!important;height:auto!important;"title="ubuntu安装vnc启用x11vnc" alt="ubuntu安装vnc启用x11vnc" src="https://zhuji.jb51.net/uploads/img/202305/c995abb1b0ab24c334734c3067434d1c.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
接下来创建登陆密码<br><br>
</p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
<p>
代码如下:</p>
</div>
<div class="msgborder" id="phpcode4" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
sudo x11vnc -storepasswd</div>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>输入和确认之后,密码被保存到了用户的密码目录下:</span></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img style="max-width:100%!important;height:auto!important;"title="ubuntu安装vnc启用x11vnc" alt="ubuntu安装vnc启用x11vnc" src="https://zhuji.jb51.net/uploads/img/202305/d93c9a6ea670dc12285c967354887068.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
再设置X11VNC的密码文件:<br><br>
</p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
<p>
代码如下:</p>
</div>
<div class="msgborder" id="phpcode5" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
sudo x11vnc -storepasswd in /etc/x11vnc.pass</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
将密码文件复制过去:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
<p>
代码如下:</p>
</div>
<div class="msgborder" id="phpcode6" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
sudo cp /root/.vnc/passwd /etc/x11vnc.pass</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
打开/etc/init/x11vnc.conf文件,粘贴以下内容。如果没有这个文件,就用文本工具创建一个。端口:5900,自己可以定义。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
<p>
代码如下:</p>
</div>
<div class="msgborder" id="phpcode7" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
start on login-session-start<br>
script<br>
/usr/bin/x11vnc -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes<br>
-noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o<br>
/var/log/x11vnc.log<br>
end script</div>
<p>
</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img style="max-width:100%!important;height:auto!important;"title="ubuntu安装vnc启用x11vnc" alt="ubuntu安装vnc启用x11vnc" src="https://zhuji.jb51.net/uploads/img/202305/b6966fa6c56188aefd6aafa2ce74ddbd.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
保存后重启Ubuntu。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
在别的操作系统里启动VNC Viewer,这里用的是Windows 7下安装的Real VNC。输入对应的IP地址或主机名,点击Connect连接。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img style="max-width:100%!important;height:auto!important;"title="ubuntu安装vnc启用x11vnc" alt="ubuntu安装vnc启用x11vnc" src="https://zhuji.jb51.net/uploads/img/202305/e8112439a5dd3307a9c1eb810bca8121.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
如图,可见Ubuntu登陆界面。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<img style="max-width:100%!important;height:auto!important;"title="ubuntu安装vnc启用x11vnc" alt="ubuntu安装vnc启用x11vnc" src="https://zhuji.jb51.net/uploads/img/202305/4bea544dfb9509721701e8c99a58a960.jpg"></p> 感谢楼主的详细教程!这个方法真的很实用,对于需要在Ubuntu上远程控制桌面的朋友来说很有帮助。
我之前也用过x11vnc,感觉比那些vnc服务器有个好处就是可以直接看到登录界面,这样远程协助的时候特别方便。
给新手朋友们补充几点小建议:
[*]如果端口5900被其他程序占用,可以改成别的端口,比如5901、5902之类的
[*]记得在防火墙里开放对应的端口,否则外部连接不上
[*]如果是内网使用问题不大,如果要通过外网访问,记得做好安全措施,比如使用ssh隧道或者限制IP
另外如果是Ubuntu 22.04或者更新版本,可能需要把启动脚本里的路径改一下,因为有些版本的lightdm路径可能不一样。
再次感谢分享!好人一生平安:
頁:
[1]