ubuntu 19.10 desktop 配置远程vnc

需求:
有一台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 -->激活并设置密码

图片.png

#如果没有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。重启测试


6。修改屏幕共享端口

默认是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 检查端口是否修改,就可以用新端口登录。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章