$ x11vnc -storepasswd
Enter VNC password:
Verify password:
Write password to /root/.vnc/passwd? [y]/n y #此处键入 y 回车
Password written to: /root/.vnc/passwd
$ vncserver :1
You will require a password to access your desktops.
Password: # 注意,密码最少六位数!
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
New 'ykla:1 (ykla)' desktop is ykla:1
Creating default config /home/ykla/.vnc/config
Starting applications specified in /home/ykla/.vnc/xstartup
Log file is /home/ykla/.vnc/ykla:1.log
$ vncserver :0
Warning: ykla:0 is taken because of /tmp/.X11-unix/X0
Remove this file if there is no X server ykla:0
A VNC server is already running as :0
如果启动服务时未通信端口,则系统根据使用情况自动指定。
可以查看进程:
$ ps
PID TT STAT TIME COMMAND
……省略无用内容……
4769 0 S 0:02.72 /usr/local/bin/Xvnc :1 -auth /home/ykla/.Xauthority -desktop ykla:1 (ykla)
关闭服务请用命令 vncserver -kill :1,这里必须指定通信端口。
如果启用了防火墙,以 ipfw 为例,在终端输入命令:
# ipfw add allow tcp from any to me 5900-5910 in keep-state
上行命令表示放通端口 5900-5910,即 DISPLAY 0-10。
参考文献
XRDP(被控端)
安装软件包(基于 kde6)
# pkg install xorg kde xrdp wqy-fonts xdg-user-dirs pulseaudio-module-xrdp
或者:
# cd /usr/ports/x11/xorg/ && make install clean
# cd /usr/ports/x11/kde/ && make install clean
# cd /usr/ports/net/xrdp/ && make install clean
# cd /usr/ports/x11-fonts/wqy/ && make install clean
# cd /usr/ports/devel/xdg-user-dirs/ && make install clean
# cd /usr/ports/audio/pulseaudio-module-xrdp && make install clean
查看配置文件:
root@ykla:/usr/ports/net/xrdp # pkg info -D xrdp
xrdp-0.10.2_2,1:
On install:
xrdp has been installed.
# xrdp 已成功安装。
There is an rc.d script, so the service can be enabled by adding this line
in /etc/rc.conf:
xrdp_enable="YES"
xrdp_sesman_enable="YES"
# 提供了 rc.d 启动脚本,可通过在 /etc/rc.conf 中添加以上两行启用服务。
# 第一个启动 xrdp 主服务,第二个启动会话管理器(sesman)。
Do not forget to edit the configuration files in "/usr/local/etc/xrdp"
and the "/usr/local/etc/xrdp/startwm.sh" script.
# 别忘了编辑 /usr/local/etc/xrdp 下的配置文件,
# 以及修改 /usr/local/etc/xrdp/startwm.sh 来设置登录后启动的桌面环境。
To enable audio redirection, install the following ports/packages to meet
your environment.
# 如需启用音频重定向(远程桌面声音传输),请根据你的系统环境安装以下软件包:
- audio/pipewire-module-xrdp
- audio/pulseaudio-module-xrdp
# 上述为支持 xrdp 音频的模块,可根据你使用的音频系统选择安装。
配置
# service xrdp enable
# service xrdp-sesman enable
# service dbus enable
# cd /usr/ports/net/freerdp3/
# make install clean
使用 FreeBSD 通过 freerdp3 远程链接到 Windows 11 24H2:
ykla@ykla:~ $ xfreerdp3 /u:ykla /p:z /v:192.168.31.213
……省略一部分……
441] [19244:dca12700] [ERROR][com.freerdp.crypto] - [tls_print_new_certificate_warn]: Host key verification failed.
Certificate details for 192.168.31.213:3389 (RDP-Server):
Common Name: DESKTOP-U72I6SS
Subject: CN = DESKTOP-U72I6SS
Issuer: CN = DESKTOP-U72I6SS
Valid from: Mar 4 12:39:28 2025 GMT
Valid to: Sep 3 12:39:28 2025 GMT
Thumbprint: 36:b9:be:66:ab:2b:54:32:28:46:b6:98:68:8d:6f:20:a5:d1:58:8c:09:de:cc:3d:30:e1:06:6f:4f:62:54:de
The above X.509 certificate could not be verified, possibly because you do not have
the CA certificate in your certificate store, or the certificate has expired.
Please look at the OpenSSL documentation on how to add a private CA to the store.
Do you trust the above certificate? (Y/T/N) y # 输入 y 按回车键以确认链接
xfreerdp3 /u:ykla /p:z /v:192.168.31.213:
xfreerdp3,注意前面有个 x。
/u:ykla,/u: 即 Username 用户名。ykla 是我 Windows 的登录名
/p,即 Password 密码。z 是我 Windows 用户 ykla 的登录密码
/v:,即 Server 服务器。
参考文献
freerdp2(旧稳定版,支持 NLA)
使用 pkg 安装:
# pkg ins freerdp
或者用 Ports:
# cd /usr/ports/net/freerdp/
# make install clean
使用 FreeBSD 远程链接到 Windows 11 24H2:
ykla@ykla:~ $ xfreerdp 192.168.31.213 # 注意是 xfreerdp。
[20:35:20:041] [1105:7c412000] [WARN][com.freerdp.client.common.cmdline] - ----------------------------------------
……省略一部分……
Certificate details for 192.168.31.213:3389 (RDP-Server):
Common Name: DESKTOP-U72I6SS
Subject: CN = DESKTOP-U72I6SS
Issuer: CN = DESKTOP-U72I6SS
Thumbprint: 36:b9:be:66:ab:2b:54:32:28:46:b6:98:68:8d:6f:20:a5:d1:58:8c:09:de:cc:3d:30:e1:06:6f:4f:62:54:de
The above X.509 certificate could not be verified, possibly because you do not have
the CA certificate in your certificate store, or the certificate has expired.
Please look at the OpenSSL documentation on how to add a private CA to the store.
Do you trust the above certificate? (Y/T/N) y # 输入 y 回车
Domain: # 留空
Password: # 输入密码,密码不会显示出来 ***。
……省略一部分……
故障排除与未竟事宜
但是我没有输入用户名就连上了?
不知道。难道是因为我的 FreeBSD 用户名和 Windows 是一样的?
rdesktop(不支持 NLA)
net/xrdesktop2 是 rdesktop 的图形化前端,但我打开里面的键盘设置就卡死了。
使用 pkg 安装 rdesktop:
# pkg install rdesktop
或者用 Ports:
# cd /usr/ports/net/rdesktop/
# make install clean
rdesktop 无前端 GUI,故要在终端输入命令:
# rdesktop ip:端口 # 比如 192.168.31.155:3389
如果没有特意更改 Windows 配置,无须加 :端口。
对于我测试的 Windows 11 24H2 会报错:
ykla@ykla:~ $ rdesktop 192.168.31.213
Failed to connect, CredSSP required by server (check if server has disabled old TLS versions, if yes use -V option).
ykla@ykla:~ $ rdesktop 192.168.31.213
ATTENTION! The server uses and invalid security certificate which can not be trusted for
the following identified reasons(s);
1. Certificate issuer is not trusted by this system.
Issuer: CN=DESKTOP-U72I6SS
Review the following certificate info before you trust it to be added as an exception.
If you do not trust the certificate the connection atempt will be aborted:
Subject: CN=DESKTOP-U72I6SS
Issuer: CN=DESKTOP-U72I6SS
Valid From: Tue Mar 4 20:39:28 2025
To: Wed Sep 3 20:39:28 2025
Certificate fingerprints:
sha1: 599c0e8bbc57c5ee8de8993d5241fb0f0d70e98d
sha256: 36b9be66ab2b54322846b698688d6f20a5d1588c09decc3d30e1066f4f6254de
Do you trust this certificate (yes/no)? # 输入 yes,按回车键
故障排除与未竟事宜
看视频没声音
待解决
参考文献
anydesk
使用 anydesk 可进行远程访问,FreeBSD 上仅支持 x86 架构:
由于版权问题(私有软件未经许可默认禁止分发),必须用户使用 Ports 自行编译:
# cd /usr/ports/deskutils/anydesk/
# make install clean
不可使用 BATCH=yes 参数,因为需要接受许可协议才能使用:
查看安装后说明:
root@ykla:/ # pkg info -D anydesk
anydesk-6.1.1_2:
On install:
1. Minimum OS version.
======================
Anydesk is a binary package for FreeBSD.
Minimal recommended is 1 GiB system memory
installed but performence will be reduced.
For good performance is recommended and 2 GiB
system memory.
# Anydesk 是适用于 FreeBSD 的二进制软件包。
# 最低推荐内存为 1 GiB,但这将导致性能下降。
# 若要获得良好性能,建议至少配备 2 GiB 系统内存。
2. Important settings
=====================
Since Version 2.9.1 the following prerequisites have to be met:
# 从 2.9.1 版本起,必须满足以下前提条件:
You need a mounted /proc directory. Either mount it manually or add it to your /etc/fstab file:
# 需要挂载 /proc 目录,可手动挂载,或将其写入 /etc/fstab 以便开机自动挂载:
fstab: proc /proc procfs rw 0 0
# 在 /etc/fstab 中添加此行以启用 procfs。
manually: # mount -t procfs proc /proc
# 或者手动执行此命令来挂载 proc 文件系统。
提示需要 /proc,经过测试没有的话的执行程序确没反应。
# mount -t procfs proc /proc # 临时用一下。持久化可以参照上面的说明做