资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

ubuntu开启vnc远程桌面的方法

概念

成都创新互联公司是一家专业提供海东企业网站建设,专注与成都网站制作、成都做网站、外贸营销网站建设H5场景定制、小程序制作等业务。10年已为海东众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。

Ubuntu是一个以桌面应用为主的开源GNU/Linux操作系统,Ubuntu 是基于Debian GNU/Linux,支持x86、amd64(即x64)和ppc架构,由全球化的专业开发团队(Canonical Ltd)打造的。

VNC (Virtual Network Computer)是虚拟网络计算机的缩写,它是一款远程控制工具软件,由Olivetti & Oracle研究室所开发,此研究室在1999年并入美国电话电报公司(AT&T)。VNC借由网络,可传送键盘与鼠标的动作及实时的屏幕画面。在Linux中,VNC包括以下四个命令:vncserver,vncviewer,vncpasswd和 vncconnect。大多数情况下用户只需要其中的两个命令:vncserver和 vncviewer。

需求:
有一台ubuntu 19.10,已安装图形界面,现需开启vnc远程桌面
分析:
由于ubuntu desktop 自带的定制了的gnome桌面系统,在该桌面系统下vnc4server和tightvncserver等均不可直接使用。
实际上Ubuntu Desktop是有桌面共享功能的,如果是最小化安装就需要单独安装它。
Ubuntu桌面共享使用的是vino。
Ubuntu桌面共享使用的是vino。
Ubuntu桌面共享使用的是vino。
在ubuntu默认的gnome环境下不要使用vnc4server和tightvncserver,使用vino。

解决:

1.开启ssh,并允许root密码登录

apt install openssh-server ssh

vi /etc/ssh/sshd_config

UsePAM yes

PermitRootLogin yes

PasswordAuthentication yes

#修改以上配置

systemctl enable ssh && systemctl restart ssh

#此时可以用root 密码登录ssh

2.开启屏幕共享

打开Settings --> Screen Sharing -->激活并设置密码

ubuntu开启vnc远程桌面的方法

#如果没有Screen Sharing选项,可能是vino没有安装,尝试apt install vino 安装

#激活后,用netstat -tulp | grep 59,查看端口是否监听590X

#如果正常,可以尝试用vnc连接,可能会出现“no security type suitable for RFB3.3”的错误。第3步就是解决这个问题。

3.关闭加密

gsettings set org.gnome.Vino require-encryption false

#关闭加密,此时vnc能正常连接

4.开启用户自动登录桌面

vino必须登录后才能启动,所以还要配置用户自动登录桌面环境

vi /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

[Seat:*]
user-session=ubuntu
greeter-show-manual-login=true
allow-guest=false

#允许root登录桌面环境

Autologin-user=root

#自动登录的用户

vi /etc/pam.d/gdm-autologin

#auth   required        pam_succeed_if.so user != root quiet_success

#注释此行

vi /etc/pam.d/gdm-password

#auth   required        pam_succeed_if.so user != root quiet_success

#注释此行

vi /etc/gdm3/custom.conf

[daemon]
# Uncomment the line below to force the login screen to use Xorg
#WaylandEnable=false

# Enabling automatic login
AutomaticLoginEnable = true
AutomaticLogin = root

#配置自动登录

vi /root/.profile

#mesg n || true
tty -s && mesg n || true

#修改mesg这行为tty

5.修改屏幕共享端口

默认是5900,但由于业务需要,改成5901

apt-get install dconf-editor

#安装dconf-editor

登录图形界面,执行dconf-editor,依次选择/org/gnome/desktop/remote-access/alternative-port 关闭默认值,手动修改为5901;

有资料说要再Again Right Click on     alternative_port and click on Set as Default (this is important),但实际测试时这步会还原成5900,不清楚是否必要。

然后打开use-alternative-port,这步很重要。

参考:https://ubuntuforums.org/showthread.php?t=1297290

netstat 检查端口是否修改,就可以用新端口登录。


网站名称:ubuntu开启vnc远程桌面的方法
链接分享:http://cdkjz.cn/article/pcgogs.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220