> For the complete documentation index, see [llms.txt](https://handbook.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://handbook.bsdcn.org/di-6-zhang-freebsd-zhong-de-wayland/6.7.-shi-yong-vnc-jin-hang-yuan-cheng-lian-jie.md).

# 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
```

> **注意**
>
> 截至本文写作时，没有可在系统初始化时启动 `wayvnc` 的 rc.d 脚本。如需此功能，则需创建本地启动文件。可考虑向 Port 维护者提出此功能请求。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.
