Skip to content

Run Codex remote control on a server

Codex on an always-on VM, steered from the ChatGPT app on your phone.

Deploy on exe.dev

Shelley handles the setup. About 5 minutes.

Prefer a terminal?
curl -fsSL https://exe-staging.dev/deploy/codex-remote-control/prompt.txt | ssh exe.dev new --prompt=/dev/stdin

Codex can run as a background service, the app-server daemon, that you control from the ChatGPT app: start a chat in a project, answer Codex's questions, approve commands and read diffs from your phone. OpenAI's guide puts that service on your Mac or PC, which then has to stay awake. Put it on an exe.dev VM instead and it's always on, on a disk that keeps your projects, chats and sign-in, and the VM opens no ports: it connects out to OpenAI's relay.

Codex comes preinstalled on exe.dev. You need a ChatGPT account with Codex access and the ChatGPT app on your phone. Remote control from the Codex CLI is marked experimental.

What you get#

  • The Codex app-server daemon with remote control turned on, run by a systemd user service and back after a reboot
  • A Git project at ~/project for Codex to work in
What's running, and where
Private the ChatGPT app your phone or computer, signed in to the same ChatGPT account as the VM
Private ssh my-codex-rc.exe.xyz your terminal, for signing in, pairing and upkeep
my-codex-rc.exe.xyz exe.dev VM
Codex app-server daemon preinstalled Codex, started by a systemd user service, with remote control on ~/.codex
OpenAI's relay the VM connects out to it; no port is opened on the VM
Your project a Git repository ~/project

Deploy with Shelley#

Click Deploy and Shelley will set up Codex Remote Control on a new VM, then check that it works. No config-file wrangling required.

Prefer a terminal?
curl -fsSL \
  https://exe-staging.dev/deploy/codex-remote-control/prompt.txt \
  | ssh exe.dev new --prompt=/dev/stdin
What Shelley is told
Set up Codex Remote Control on this VM by following the exe.dev recipe at https://exe-staging.dev/deploy/codex-remote-control.md from top to bottom.

The recipe's example VM name is my-codex-rc. This VM's name is the output of `hostname`: use it wherever the recipe writes my-codex-rc. Skip the step that creates the VM; you are on it.

You are done when all of these are true. Check each one yourself:
- The Codex app-server daemon with remote control turned on, run by a systemd user service and back after a reboot
- A Git project at `~/project` for Codex to work in

Run the VM-side commands in "Set up the VM" only; skip creating the VM.
Do not run `codex login`, `codex logout`, `exeuntu configure codex` or
`codex remote-control pair`: signing in to ChatGPT and pairing are the
owner's steps, and pairing codes expire within minutes. Verify that
`systemctl --user is-active codex-remote-control` prints `active` and
that `codex app-server daemon version` reports `"status":"running"`.
Skip the later sections and the FAQ. Finish by telling the owner to run
`ssh my-codex-rc.exe.xyz` with this VM's name and follow "Sign in and
pair your phone".

Finish with the URLs I should open.

Also at /deploy/codex-remote-control/prompt.txt. The recipe it follows is /deploy/codex-remote-control.md.

Set up the VM#

On your computer, create a VM and connect. Pick any free name: the VM shows up in the ChatGPT app under it. If you've already clicked Deploy or have a VM, skip the first command and use its name:

ssh exe.dev new --name=my-codex-rc
ssh my-codex-rc.exe.xyz

On the VM, turn on remote control for Codex's daemon and have a systemd user service start the daemon on every boot. Codex's own daemon doesn't survive a reboot by itself:

codex app-server daemon enable-remote-control
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/codex-remote-control.service <<'EOF'
[Unit]
Description=Codex app-server daemon with remote control
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/codex app-server daemon start
ExecStop=/usr/local/bin/codex app-server daemon stop

[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now codex-remote-control
git init ~/project

The first command copies Codex into ~/.codex/packages/app-server-daemon, where the daemon runs and updates itself. Check that it's up: the service is active and the daemon reports "status":"running":

systemctl --user is-active codex-remote-control
codex app-server daemon version

exe.dev VMs keep user services running without a login, so this survives reboots and disconnects.

Sign in and pair your phone#

Remote control goes through your ChatGPT account, so Codex on the VM signs in to it. First, turn on device code login in your ChatGPT security settings (a workspace admin does this in workspace permissions). Then, on the VM:

codex login --device-auth

Open the link it prints on your computer or phone, sign in, and enter the code. If you've connected this VM's Codex to exe.dev's LLM integration before, delete the model_provider = "exe-llm" line from ~/.codex/config.toml too, so Codex uses your ChatGPT plan.

Restart the daemon so it picks up the sign-in, then check the connection:

systemctl --user restart codex-remote-control
codex remote-control start

It says This machine is available for remote control as my-codex-rc. Now create a pairing code:

codex remote-control pair

It prints Pairing code: and a short code, valid for a few minutes. In the ChatGPT app on your phone, signed in to the same account and workspace, open Codex (Remote in some versions), start adding a computer, and choose to pair manually instead of scanning a QR code. Enter the code. The VM appears as my-codex-rc. Pair each phone once; the pairing is saved on the VM's disk.

Note

If your ChatGPT account belongs to a workspace, its admin may have to allow Remote Control before pairing works.

Start a chat from your phone#

In the ChatGPT app, open my-codex-rc, choose the ~/project folder and give Codex a task. For example:

Build a tiny website for a sandwich critic with strong opinions, and serve it on port 8000.

Codex works on the VM; you approve commands and read the diff on your phone, and lock it whenever you like. Open https://my-codex-rc.exe.xyz/ to see what it built: it's private to you by default (HTTPS proxy).

  • Bring your code: connect a GitHub repo to the VM, so it can clone and push with no token on the VM. On your computer, ssh exe.dev integrations add github --name myapp --repository you/myapp --attach vm:my-codex-rc; then, on the VM, git clone https://github.int.exe.xyz/you/myapp.git ~/myapp, and pick ~/myapp in the app.
  • At the keyboard: ssh my-codex-rc.exe.xyz, then codex in your project folder. The Codex page has the terminal setup.
  • Another agent: Shelley, exe.dev's own agent, is on the VM too, at https://my-codex-rc.shelley.exe.xyz/ in your phone's browser.
Update, back up and stop

Update#

The daemon updates its own copy of Codex: it checks five minutes after it starts and then hourly, and restarts with the new version, which can interrupt a running turn. To update it now, or to see what it runs:

codex app-server daemon update
codex app-server daemon version

The codex command you type is the copy exe.dev installed; sudo exeuntu update codex updates it. To stop automatic updates, put "updater": { "autoUpdateEnabled": false } in ~/.codex/app-server-daemon/settings.json next to remoteControlEnabled and run systemctl --user restart codex-remote-control.

Back up#

Your code belongs in Git: commit and push. ~/.codex holds your chats, the ChatGPT sign-in and the VM's remote-control registration. For a copy of the whole VM, run ssh exe.dev cp my-codex-rc my-codex-rc-backup on your computer. The copy carries your ChatGPT sign-in, so delete it when you no longer need it, and don't run remote control on both at once.

Stop or unpair#

Remove the device in the ChatGPT app to unpair a phone. To take the VM off remote control, run codex app-server daemon disable-remote-control on it; codex logout also signs Codex out of ChatGPT.

Troubleshooting#

  • Remote control is enabled on my-codex-rc but the connection is errored. Codex isn't signed in to ChatGPT. codex login status says Not logged in or that it uses an API key. Sign in with codex login --device-auth, then restart the service.
  • remote control pairing is unavailable until enrollment completes. Same cause: the VM hasn't registered with OpenAI's relay yet. Fix the sign-in, run codex remote-control start, then pair.
  • timed out waiting for remoteControl/pairing/start response. Run codex app-server daemon restart, then pair again.
  • The device code is rejected. Device code login is off in your ChatGPT security settings or workspace permissions.
  • The VM doesn't show up on your phone. The phone must use the same ChatGPT account and workspace as codex login status on the VM. Update the ChatGPT app and pair again.

To dig further, on the VM: codex doctor checks the install and sign-in, journalctl --user -u codex-remote-control shows the service, and ~/.codex/app-server-daemon/daemon.stderr.log is the daemon's log.

Frequently asked questions#

Can Codex on the VM use exe.dev's LLM integration instead of my ChatGPT plan?

Remote control needs a ChatGPT sign-in on the VM: Codex refuses to connect to the relay with an API key, and exe.dev's ChatGPT integration can't stand in for it, because the relay connection is made with the login stored in ~/.codex. This page uses your ChatGPT plan for the model too, which is what OpenAI supports. For ChatGPT-free Codex on a VM, use the Codex page.

Does this need the ChatGPT desktop app?

No. OpenAI's remote-connections guide describes pairing from the desktop app on macOS or Windows, but Codex CLI has its own, experimental pairing command, codex remote-control pair, which works on Linux with nothing else installed. Once paired, the VM shows up in the ChatGPT app on your phone, and on desktops that offer Control other devices.

Who can control the VM?

Devices you pair while signed in to the same ChatGPT account and workspace as the VM. The VM makes an outbound connection to OpenAI's relay, so nothing on it listens to the internet. Anyone who can sign in to that ChatGPT account and pair a device can run commands on the VM, so keep multi-factor authentication on.

Does it keep working when my laptop is closed?

Yes. Codex runs on the VM, not your laptop, and the service starts it again after a reboot. A VM restart interrupts a turn that's running; the chat itself is saved in ~/.codex.

How much does it cost?

Codex is open source. Model usage counts against your ChatGPT plan's Codex limits, and the VM is part of your exe.dev plan.

Why put the daemon on a VM at all?

Since Codex CLI 0.157.0 the daemon runs in the background by default and updates itself. Many people would rather it didn't on their laptop. On a VM of its own it can stay on, and whatever Codex does happens on a machine you can copy or throw away.

Updated Oct 31, 2026 · Markdown · manifest.json · Something wrong? Tell us