📚AI 编程官方教程中文版
📚 官方教程中文版云端与远程环境

连接远程开发环境

SSH remote connections 当前处于 alpha。

SSH remote connections 当前处于 alpha。

如果今天要启用,在 ~/.codex/config.toml[features] table 中设置:

remote_connections = true

availability、setup flows 和 supported environments 可能会随着 feature 改进而变化。

remote connections 让 Codex 可以处理位于另一台 SSH-accessible machine 上的 projects。

当你需要的 codebase、credentials、services 或 build environment 在 remote host 而不是 local machine 上时,可以使用它。

remote host 的安全配置应和正常 SSH access 保持同等标准:

  • trusted keys。
  • least-privilege accounts。
  • 不暴露 unauthenticated public listeners。

Codex App

在 Codex app 中,你可以从 SSH host 添加 remote projects,并让 threads 针对 remote filesystem 和 shell 运行。

  1. 把 host 添加到 SSH config,让 Codex 可以 auto-discover。
Host devbox
  HostName devbox.example.com
  User you
  IdentityFile ~/.ssh/id_ed25519

Codex 会从 ~/.ssh/config 读取 concrete host aliases,通过 OpenSSH resolve,并忽略 pattern-only hosts。

  1. 确认运行 Codex app 的这台机器可以 SSH 到该 host。
ssh devbox
  1. 在 remote host 上安装并登录 Codex。

app 会通过 SSH 启动 remote Codex app server,使用 remote user's login shell。

请确认 remote host 的该 shell 中,codex command 在 PATH 内可用。

  1. 在 Codex app 中打开 Settings > Connections,添加或启用 SSH host,然后选择 remote project folder。

如果 remote connections 还没有出现,请在 ~/.codex/config.toml 中启用 alpha feature flag:

[features]
remote_connections = true

remote project threads 会在 remote host 上运行 commands、读取 files,并写入 changes。

截图:

认证和网络暴露

使用 SSH port forwarding,并配合 local-host WebSocket listeners。

不要在 shared 或 public network 上暴露 unauthenticated app-server listener。

如果你需要访问当前 network 之外的 remote machine,请使用 VPN 或 Tailscale 这类 mesh networking tool,而不是把 app server 直接暴露到 internet。

相关入口

On this page