# 6.7.使用 VNC 进行远程连接

之前文中提到，Wayland 不提供与 Xorg 相同的 X 服务器访问方式。但用户可以选择远程桌面协议，如 RDP 或 VNC。FreeBSD Ports 有 `wayvnc`，它支持基于 wlroots 的合成器，如本文中讨论的那些。可以使用以下命令安装该应用：

```sh
# pkg install wayvnc
```

与其他一些包不同，`wayvnc` 没有配置文件。幸运的是，手册页文档中列出了重要的选项，这些选项可以提取成一个简单的配置文件：

```ini
address=0.0.0.0
enable_auth=true
username=username
password=password
private_key_file=/path/to/key.pem
certificate_file=/path/to/cert.pem
```

需要生成密钥文件，并强烈建议使用它们来增强连接的安全性。启动 `wayvnc` 时，它会在 `~/.config/wayvnc/config` 中查找配置文件。也可以在启动服务器时使用 `-C configuration_file` 选项覆盖该配置文件。因此，要启动 `wayvnc` 服务器，可以执行以下命令：

```sh
% wayvnc -C ~/.config/wayvnc/config
```

> **警告**
>
> 在本文写作时，没有 rc.d 脚本来在系统初始化时启动 `wayvnc`。如果需要此功能，则需要创建一个本地启动文件。这可能是一个针对 Port 维护者的功能请求。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://handbook.bsdcn.org/di-6-zhang-freebsd-zhong-de-wayland/6.7.-shi-yong-vnc-jin-hang-yuan-cheng-lian-jie.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
