在openSUSE-Leap-15.5-DVD-x86_64的gnome下使用远程桌面tigervnc
在openSUSE-Leap-15.5-DVD-x86_64的tigervnc-1.12.0软件设计有变动了,变为一开机就启动远程桌面服务,没有vncserver取而代之是Xvnc,也在自己之前写的一篇博文的基础上作了修改
《在openSUSE-Leap-15.2-DVD-x86_64的kde下使用远程桌面tigervnc》
https://blog.csdn.net/weixin_42145772/article/details/119722303
目的————是笔记本电脑和台式机同时可以上网,而且笔记本电脑可以通过tigervnc软件远程控制台式机
安卓手机——设置——网络和互联网——热点和网络共享——WLAN热点——设置WLAN热点——网络名称为ZTE_Blade_A7s,安全性为WPA2 PSK,密码为自己的手机号码xxxxxxxxx——手机有流量并可以上网的
台式机是安装openSUSE-Leap-15.5-DVD-x86_64的gnome桌面,有USB无线网卡翼联EP-AC1610——连接到手机的便携式热点并且可以上网
笔记本电脑是安装Windows XP——连接到手机的便携式热点并且可以上网
一、台式机的操作
台式机是安装openSUSE-Leap-15.5-DVD-x86_64的gnome桌面,先关闭防火墙并且设置开机不开启防火墙,只有先成功了才能打开防火墙进行下一步的试验,因为开启防火墙会有意外的坏情况出现,如黑屏,得不到满意的分辨率1360x670
localhost:~ # systemctl stop firewalld.service
localhost:~ # systemctl disable firewalld.service
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
localhost:~ # ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 00:e0:4c:8d:87:b3 brd ff:ff:ff:ff:ff:ff
3: wlan2: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e8:4e:06:7d:16:b3 brd ff:ff:ff:ff:ff:ff
inet 192.168.43.252/24 brd 192.168.43.255 scope global wlan2
localhost:~ # ip route
default via 192.168.43.69 dev wlan2 proto dhcp
192.168.43.0/24 dev wlan2 proto kernel scope link src 192.168.43.252
localhost:~ # ip neigh
192.168.43.69 dev wlan2 lladdr 62:14:66:f7:1c:65 STALE
192.168.43.133 dev wlan2 lladdr 48:5d:60:94:0e:84 STALE
fe80::6014:66ff:fef7:1c65 dev wlan2 lladdr 62:14:66:f7:1c:65 router STALE
显示台式机的IP地址为192.168.43.252,网关192.168.43.69,在同一网段内有一个IP地址为192.168.43.133,这是笔记本电脑的IP地址
屏幕左上角应用程序——其它——Yast——输入root密码——Remote Administration(VNC)远程管理设置——允许远程管理(含会话管理)(A)——允许使用Web浏览器访问——打开防火墙中的端口(F)——下一步——会提示要求安装vncmanager等软件包
localhost:~ # rpm -aq|grep vnc
tigervnc-1.12.0-150500.2.6.x86_64
vncmanager-1.0.2-150000.4.9.3.x86_64
xorg-x11-Xvnc-1.12.0-150500.2.6.x86_64
libvncclient1-0.9.13-150400.3.3.1.x86_64
vncmanager-controller-gnome-1.0.1-3.3.1.x86_64
xorg-x11-Xvnc-module-1.12.0-150500.2.6.x86_64
libgvnc-1_0-0-1.3.1-150400.3.3.1.x86_64
x11vnc-0.9.16-bp155.2.11.x86_64
xorg-x11-Xvnc-novnc-1.12.0-150500.2.6.noarch
libvncserver1-0.9.13-150400.3.3.1.x86_64
vncmanager-greeter-1.0.0-1.48.x86_64
libgtk-vnc-2_0-0-1.3.1-150400.3.3.1.x86_64
vncmanager-controller-1.0.1-3.3.1.x86_64
libXvnc1-1.12.0-150500.2.6.x86_64
novnc-1.2.0-150100.3.6.1.noarch
gtk-vnc-lang-1.3.1-150400.3.3.1.noarch
重要的科普知识——系统有三个用户root、ruhong和suozhang,root对应:0是默认禁止登录远程桌面服务的,ruhong对应:1是台式机一开机就自动登录的,不能同时登录本机同时提供远程桌面服务的,suozhang对应:2是另外创建的用于提供远程桌面服务的,之后用户xxxxxx对应:n就可以提供远程桌面服务了(n>=2)
创建普通用户suozhang包括家目录并设置系统登录密码
localhost:~ # useradd suozhang
localhost:~ # mkdir /home/suozhang
localhost:~ # id suozhang
uid=1001(suozhang) gid=100(users) groups=100(users)
localhost:~ # chown -R suozhang.users /home/suozhang
localhost:~ # passwd suozhang
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: password updated successfully
一定要切换到普通用户suozhang运行vncpasswd设置远程服务登录密码
localhost:~ # su -l suozhang
suozhang@localhost:~>
suozhang@localhost:~> vncpasswd
Password:
Verify:
输入密码不会显示出来
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
suozhang@localhost:~>
会自动创建.vnc目录和passwd文件
suozhang@localhost:~> cd .vnc/
suozhang@localhost:~/.vnc> ls
config localhost.localdomain:2.log passwd
suozhang@localhost:~/.vnc> vim config
session=gnome
securitytypes=vncauth,tlsvnc
geometry=1360x670
在/usr/share/xsessions/中有gnome.desktop而session=gnome后面不用写上.desktop,虽然官方样本文件是有localhost,但是经过实际测试它是限制只能在本地登录和禁止从同网段的其它机器登录的,不能带有localhost
localhost:~ # vim /etc/tigervnc/vncserver.users
:0=root
:1=ruhong
:2=suozhang
数字2前面有英文冒号:
localhost:~ # systemctl enable vncserver@:2.service
Created symlink /etc/systemd/system/multi-user.target.wants/vncserver@:2.service → /usr/lib/systemd/system/vncserver@.service.
localhost:~ # systemctl enable vncmanager.service
Created symlink /etc/systemd/system/multi-user.target.wants/vncmanager.service → /usr/lib/systemd/system/vncmanager.service.
设置开机自动启用远程桌面服务,并重启一次台式机
ruhong@localhost:~> ps -ef |grep vnc
root 811 1 0 22:04 ? 00:00:00 /usr/sbin/vncsession suozhang :2
suozhang 921 811 0 22:04 ? 00:00:00 xinit /etc/X11/xdm/Xsession env GNOME_SHELL_SESSION_MODE=classic gnome-session – /usr/bin/Xvnc :2 -alwaysshared -geometry 1360x670 -securitytypes vncauth,tlsvnc -auth /home/suozhang/.Xauthority -desktop localhost.localdomain:2 (suozhang) -fp /usr/share/fonts/misc,/usr/share/fonts/75dpi,/usr/share/fonts/100dpi,/usr/share/fonts/Type1 -pn -rfbauth /home/suozhang/.vnc/passwd -rfbport 5902
suozhang 985 921 0 22:04 ? 00:00:01 /usr/bin/Xvnc :2 -alwaysshared -geometry 1360x670 -securitytypes vncauth,tlsvnc -auth /home/suozhang/.Xauthority -desktop localhost.localdomain:2 (suozhang) -fp /usr/share/fonts/misc,/usr/share/fonts/75dpi,/usr/share/fonts/100dpi,/usr/share/fonts/Type1 -pn -rfbauth /home/suozhang/.vnc/passwd -rfbport 5902
vnc 4804 1 0 22:07 ? 00:00:00 /usr/bin/vncmanager
ruhong 4963 2967 0 22:08 pts/0 00:00:00 grep --color=auto vnc
重启之后输入ps -ef |grep vnc并看到上面的内容,表明开启远程桌面服务了
二、笔记本电脑的操作
到https://bintray.com/tigervnc/stable/tigervnc/1.6.0下载tigervnc-1.6.0.exe大小为9.8 MB并安装
在Windows XP下双击TigerVNC Viewer并输入
192.168.43.252:2
注意网址后面有:2
三、调整远程桌面的分辨率
作者的笔记本是10.1寸分辨率为1366×768,而远程桌面的分辨率是1024x768,是超出笔记本的显示屏,使用十分不方便
预留顶部状态栏和底部状态栏,还有右边的滚动条,所以分辨率1360x670就刚好铺满显示屏中间了
在openSUSE-Leap-15.5-DVD-x86_64中不用修改/etc/vnc/vncmanager.conf,只需要修改用户家目录下的~/.vnc/config就可以了
一定要切换到普通用户suozhang修改自己的config文件
localhost:~ # su -l suozhang
suozhang@localhost:~>
suozhang@localhost:~> vim /home/suozhang/.vnc/config
geometry=1360x670
session=gnome
securitytypes=vncauth,tlsvnc
其中session=gnome和securitytypes=vncauth,tlsvnc是必须的
四、开启防火墙firewalld
因为开启防火墙会有意外的坏情况出现,如黑屏,得不到满意的分辨率1360x670,不保定百分百成功
localhost:~ # systemctl enable firewalld.service
Created symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service → /usr/lib/systemd/system/firewalld.service.
Created symlink /etc/systemd/system/multi-user.target.wants/firewalld.service → /usr/lib/systemd/system/firewalld.service.
localhost:~ # systemctl start firewalld.service
台式机是安装openSUSE-Leap-15.5-DVD-x86_64的gnome桌面,防火墙软件是firewalld,默认是有开启ssh,也可以重复手动开启ssh
localhost:~ # firewall-cmd --add-service=ssh --permanent
success
localhost:~ # firewall-cmd --reload
success
localhost:~ # firewall-cmd --list-services
dhcpv6-client tigervnc tigervnc-https ssh
屏幕左上角应用程序——其它——Yast——输入root密码——Remote Administration(VNC)远程管理设置——允许远程管理(含会话管理)(A)——允许使用Web浏览器访问——打开防火墙中的端口(F)——下一步——会提示要求安装vncmanager等软件包
ruhong@localhost:~> ps -ef |grep vnc
root 811 1 0 22:04 ? 00:00:00 /usr/sbin/vncsession suozhang :2
suozhang 921 811 0 22:04 ? 00:00:00 xinit /etc/X11/xdm/Xsession env GNOME_SHELL_SESSION_MODE=classic gnome-session – /usr/bin/Xvnc :2 -alwaysshared -geometry 1360x670 -securitytypes vncauth,tlsvnc -auth /home/suozhang/.Xauthority -desktop localhost.localdomain:2 (suozhang) -fp /usr/share/fonts/misc,/usr/share/fonts/75dpi,/usr/share/fonts/100dpi,/usr/share/fonts/Type1 -pn -rfbauth /home/suozhang/.vnc/passwd -rfbport 5902
suozhang 985 921 0 22:04 ? 00:00:01 /usr/bin/Xvnc :2 -alwaysshared -geometry 1360x670 -securitytypes vncauth,tlsvnc -auth /home/suozhang/.Xauthority -desktop localhost.localdomain:2 (suozhang) -fp /usr/share/fonts/misc,/usr/share/fonts/75dpi,/usr/share/fonts/100dpi,/usr/share/fonts/Type1 -pn -rfbauth /home/suozhang/.vnc/passwd -rfbport 5902
vnc 4804 1 0 22:07 ? 00:00:00 /usr/bin/vncmanager
ruhong 4963 2967 0 22:08 pts/0 00:00:00 grep --color=auto vnc
信息-rfbport 5902显示是使用5902端口,所以防火墙要打开5902端口
localhost:~ # firewall-cmd --add-port=5902/tcp
success
localhost:~ # firewall-cmd --add-port=5902/udp
success
localhost:~ # firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0 wlan2
sources:
services: dhcpv6-client tigervnc tigervnc-https ssh
ports: 5902/tcp 5902/udp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
ruhong@localhost:~> ss -a|grep 590
nl UNCONN 0 0 uevent:-1775590744 *
nl UNCONN 0 0 uevent:-1775590744 *
u_str ESTAB 0 0 @/tmp/dbus-l0qWRdTNw7 48590 * 49521
u_str ESTAB 0 0 * 49521 * 48590
tcp LISTEN 0 32 0.0.0.0:5901 0.0.0.0:*
tcp LISTEN 0 5 0.0.0.0:5902 0.0.0.0:*
tcp LISTEN 0 32 [::]:5901 [::]😗
tcp LISTEN 0 5 [::]:5902 [::]😗
在笔记本的Windows XP下双击TigerVNC Viewer并输入
192.168.43.252:2
出错信息——黑屏
是因为直接用root用户创建/.vnc/config,而普通用户没有权限读取/.vnc/config
出错信息unable connect socket: Connection refused (10061)(111)
是因为~/.vnc/config中含有localhost参数,是限制只能在本地登录和禁止从同网段的其它机器登录的,还有可能防火墙阻止连接了
其它出错信息可以在~/.vnc/localhost.localdomain:2.log有提示原因
五、改用其它桌面模式
localhost:~ # ls /usr/share/xsessions/
default.desktop gnome-xorg.desktop icewm-session.desktop sle-classic.desktop
gnome-classic.desktop gnome.desktop icewm.desktop
默认是使用gnome.desktop,如果要使用gnome-classic.desktop
地方一——/home/suozhang/.vnc/config中的session=gnome改为session=gnome-classic
地方二——/var/lib/AccountsService/users/suozhang中的Session=gnome改为Session=gnome-classic
地方三——localhost:~ # ll /etc/alternatives/default-xsession.desktop
lrwxrwxrwx 1 root root 42 Jun 19 21:54 /etc/alternatives/default-xsession.desktop -> /usr/share/xsessions/gnome.desktop
默认是指向gnome.desktop
localhost:~ # rm /etc/alternatives/default-xsession.desktop
localhost:~ # ln -s /usr/share/xsessions/gnome-classic.desktop /etc/alternatives/default-xsession.desktop
改为默认指向gnome-classic.desktop
localhost:~ # ll /etc/alternatives/default-xsession.desktop
lrwxrwxrwx 1 root root 42 Jun 19 21:54 /etc/alternatives/default-xsession.desktop -> /usr/share/xsessions/gnome-classic.desktop
要保持三个地方都指向同一个桌面模式,有gnome、gnome-classic和sle-classic可用
屏幕左上角应用程序——其它——设置——隐私——锁屏——关闭自动锁屏——关闭在锁定屏幕上显示通知
文章来源:https://www.toymoban.com/news/detail-497962.html
六、参考网络文章
localhost:~ # rpm -ql xorg-x11-Xvnc-1.12.0-150500.2.6.x86_64 |grep doc
/usr/share/doc/packages/xorg-x11-Xvnc
/usr/share/doc/packages/xorg-x11-Xvnc/HOWTO.md
/usr/share/doc/packages/xorg-x11-Xvnc/README.rst
/usr/share/doc/packages/xorg-x11-Xvnc/vnc.reg
其中HOWTO.md有介绍操作步骤文章来源地址https://www.toymoban.com/news/detail-497962.html
到了这里,关于在openSUSE-Leap-15.5-DVD-x86_64的gnome下使用远程桌面tigervnc的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!