前言
准备工作:
1.两台装有Linux系统的主机(虚拟机可以代替)
2.主机连接网线
提示:以下是本篇文章正文内容,步骤可供参考
一、安装remmina
两台主机在命令终端都进行以下操作
1.更新软件列表:apt update
2.安装remmian:apt install remmina
(提示:第2步操作后,会显示新安装1个软件包,由于我的主机已经安装过,所有显示新安装了0个软件包)
3.安装x11vnc:apt install x11vnc
二、远程控制
我们采取主机2控制主机1
1.主机1操作
1.提前查看IP地址:ifconfig(示例:192.168.1.168)
2.设置remmina密码:x11vnc -storepasswd
3.打开vnc远程服务:x11vnc -forever -shared -rfbauth ~/.vnc/passwd
操作代码如下(示例):
root@lixi-virtual-machine:/home/lixi# x11vnc -storepasswd
Enter VNC password:
Verify password:
Write password to /root/.vnc/passwd? [y]/n y
Password written to: /root/.vnc/passwd
root@lixi-virtual-machine:/home/lixi# x11vnc -forever -shared -rfbauth ~/.vnc/passwd
05/02/2021 10:30:55 passing arg to libvncserver: -rfbauth
05/02/2021 10:30:55 passing arg to libvncserver: /root/.vnc/passwd
05/02/2021 10:30:55 x11vnc version: 0.9.13 lastmod: 2011-08-10 pid: 3007
05/02/2021 10:30:55 Using X display :0
05/02/2021 10:30:55 rootwin: 0x255 reswin: 0x3600001 dpy: 0x1a0a020
2.主机2操作
1.打开remmina:remmina
2.在弹出的Remmina远程桌面客户端,选择vnc连接远程桌面
3.输入主机1的IP地址,输入主机1设置的密码,确定连接
代码如下(示例):
root@sw-PC:/home/sw/Desktop# remmina
** (org.remmina.Remmina:3433): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
StatusNotifier/Appindicator support: not supported by desktop. libappindicator will try to fallback to GtkStatusIcon/xembed
WARNING: Remmina is running without a secret plugin. Passwords will be saved in a less secure way.
(org.remmina.Remmina:3433): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem
(org.remmina.Remmina:3433): Gtk-CRITICAL **: gtk_toggle_action_set_active: assertion 'GTK_IS_TOGGLE_ACTION (action)' failed
WARNING: unable to load remmina profile file /root/.config/remmina/remmina.pref: cannot find key name= in section remmina.
(org.remmina.Remmina:3433): Gtk-WARNING **: /work/gtk/gtk+3.0/gtk+3.0-3.22.11/./gtk/gtkwidget.c:8563: widget not within a GtkWindow
WARNING: unable to load remmina profile file /root/.config/remmina/remmina.pref: cannot find key name= in section remmina.
(org.remmina.Remmina:3433): Gtk-WARNING **: /work/gtk/gtk+3.0/gtk+3.0-3.22.11/./gtk/gtkwidget.c:8563: widget not within a GtkWindow
连接成功。
总结
被控制端(主机1)需要设置密码,并打开远程服务器,控制端(主机2)直接运行remmina程序,进行vpn连接控制。
后记:路漫漫其修远今,吾将上下而求索。