Back to blog
12 min read

Claude Code vs Codex: Which Is Better on a Linux Server?

Claude Code vs Codex for coding on your own Linux server: how they differ in setup, safety and phone access, and which one fits your plan and the way you work.

TL;DR:

  • Claude Code vs Codex: both are terminal coding agents that install as a regular user with one script. Claude Code is Anthropic's and runs Claude models; Codex CLI is OpenAI's, open source under Apache-2.0.
  • Claude Code needs a Claude Pro, Max, Team or Enterprise plan or a Claude Console account. Codex CLI comes with ChatGPT Plus, Pro, Business, Edu and Enterprise, or an OpenAI API key.
  • Codex sandboxes its commands with bubblewrap by default, with network access off. Claude Code's bubblewrap sandbox stays off until you run /sandbox.
  • Claude Code Remote Control reaches a server session from the Claude app on iOS or Android; Codex reaches it from the ChatGPT mobile app through a ChatGPT desktop app host.
  • Anthropic lists 4 GB of RAM or more for Claude Code; OpenAI lists 4 GB minimum and 8 GB recommended for Codex CLI.

Applies to: Ubuntu 26.04 LTS and 24.04 LTS · Claude Code 2.1.312 · Codex CLI 0.165.0 · checked October 2026

Claude Code is Anthropic's agentic coding tool: a terminal program that reads a codebase, edits files and runs commands, and sends model requests to Anthropic. Codex CLI is the Rust-based terminal version of OpenAI's Codex coding agent, which also runs in an IDE extension, the ChatGPT desktop app and the cloud; it runs its commands inside an operating-system sandbox. This Claude Code vs Codex comparison covers both CLIs on a remote Linux server.

Choose Claude Code if you have a Claude plan and want to steer a server session from the Claude phone app. Choose Codex CLI if you have a ChatGPT plan or want an open-source agent whose commands run sandboxed, with no network access, by default.

Claude Code vs Codex CLI at a glance

Claude CodeCodex CLI
MakerAnthropicOpenAI
Source codeProprietary, under Anthropic's Commercial TermsOpen source, Apache-2.0
ModelsClaude models only, including through a gatewayOpenAI models by default; other providers in config.toml
Install on LinuxNative installer script, signed apt, dnf and apk repositories, or npmInstall script, npm or Homebrew
Installed binary~/.local/bin/claude from the native installer, updated in the background~/.local/bin/codex, updated by rerunning the script or codex update
Sign-in over SSHclaude auth login, then paste the code from the browsercodex login --device-auth (beta, turned on in ChatGPT first), or codex login through an SSH tunnel to port 1455
API keyANTHROPIC_API_KEY, or claude auth login --consolecodex login --with-api-key, read from standard input
Linux sandboxbubblewrap and socat; off by default; shell commands onlybubblewrap; on by default
ModesManual, acceptEdits, plan, auto, dontAsk, bypassPermissionsSandbox read-only, workspace-write, danger-full-access; approvals on-request, never; /plan mode
Interactive defaultauto mode (v2.1.283 and later), or Manual when auto mode is unavailableworkspace-write with on-request approvals in a Git repository (read-only elsewhere), network off
Project instructionsCLAUDE.md, or AGENTS.md when the repository has no CLAUDE.md (v2.1.277 and later)AGENTS.md
Phone accessRemote Control in the Claude app for iOS and AndroidCodex in the ChatGPT mobile app, through a ChatGPT desktop app host on macOS or Windows
Documented RAM4 GB or more4 GB minimum, 8 GB recommended
PlansPro, Max, Team, Enterprise, or a Claude Console accountChatGPT Plus, Pro, Business, Edu and Enterprise, or an API key

How do you sign in to Claude Code or Codex over SSH?

Both agents' default sign-in opens a browser on the same machine, and a server has none. Connect as a non-root user with sudo privileges and SSH key login, as How to Generate an SSH Key shows, and run the agents as an unprivileged user without sudo, such as coder from the install tutorials.

Claude Code. Run the login command:

claude auth login

The output looks similar to this:

Opening browser to sign in...
If the browser didn't open, visit: https://claude.com/cai/oauth/authorize?code=true&client_id=...
Paste code here if prompted >

Open the link on your computer, sign in, and paste the code the browser shows at the prompt. For API billing, run claude auth login --console or set ANTHROPIC_API_KEY, which Claude Code asks you to approve.

Codex. Device code login is a beta that you turn on in ChatGPT security settings, or that a workspace admin allows in workspace permissions. Then run:

codex login --device-auth

The output looks similar to this:

Welcome to Codex [v0.165.0]
OpenAI's command-line coding agent

Follow these steps to sign in with ChatGPT using device code authorization:

1. Open this link in your browser and sign in to your account
   https://auth.openai.com/codex/device

2. Enter this one-time code (expires in 15 minutes)
...

Without device code login, forward Codex's callback port from your computer with ssh -L 1455:localhost:1455 coder@YOUR_SERVER_IP, where YOUR_SERVER_IP is your server's address, then run codex login in that session and open the printed address.

For an API key, set OPENAI_API_KEY and run printenv OPENAI_API_KEY | codex login --with-api-key, which reads the key from standard input. Codex saves the sign-in in ~/.codex/auth.json or the system credential store; treat that file like a password.

Claude Code vs Codex on Linux: which sandbox does each use?

Both agents use bubblewrap (bwrap) on Linux. In a Git repository, Codex sandboxes the commands it starts by default, in the workspace-write sandbox with on-request approvals: commands write only in the workspace and temp folders, have no network access, and Codex asks before crossing that boundary.

Claude Code keeps permission modes, listed in the table, separate from its sandbox, which is off by default; /sandbox or "sandbox": {"enabled": true} in ~/.claude/settings.json turns it on. It covers shell commands, not Claude's file tools, MCP servers or hooks. Writes stay in the working directory and a per-user temp directory, reads cover most of the machine, including ~/.ssh, and network traffic goes through a proxy whose allowed domains start empty.

If a dependency such as socat is missing, Claude Code runs commands without the sandbox; "failIfUnavailable": true in the sandbox block makes it exit at startup instead. Codex prints a startup warning when bwrap is missing or cannot create its user namespace.

As the sudo user, install bubblewrap for both agents and socat for Claude Code's sandbox:

sudo apt update && sudo apt install -y bubblewrap socat

Ubuntu limits unprivileged user namespaces through AppArmor. Run this check as the agent user, without sudo:

bwrap --unshare-user --unshare-net --ro-bind / / /bin/true && echo "bubblewrap OK"

If it fails, Anthropic's sandboxing page adds /etc/apparmor.d/bwrap for Claude Code when sysctl kernel.apparmor_restrict_unprivileged_userns returns 1. For Codex on Ubuntu 24.04, the Codex CLI tutorial loads Ubuntu's bwrap-userns-restrict profile, as OpenAI documents. Both files define a profile named bwrap for /usr/bin/bwrap, so add only one and run the check again. Ubuntu 26.04 already installs bwrap-userns-restrict with the apparmor package.

codex sandbox runs a command under Codex's policy without a sign-in, here with the built-in :workspace profile (beta):

mkdir -p ~/sandbox-test && cd ~/sandbox-test && git init -q
codex sandbox -P :workspace -C ~/sandbox-test -- \
  bash -c 'touch inside.txt && echo "write inside: ok"; touch ~/outside.txt; curl -sS -o /dev/null https://example.com'

The output looks similar to this:

write inside: ok
touch: cannot touch '/home/coder/outside.txt': Read-only file system
curl: (6) Could not resolve host: example.com

Can you reach a Claude Code or Codex session from your phone?

Yes, by different routes. Claude Code opens no inbound port, and the ChatGPT desktop app reaches the server over your existing SSH access.

Claude Code Remote Control connects claude.ai/code or the Claude app on iOS and Android to a server session, while files and commands stay there. Run /remote-control in a session. Anthropic stores the session transcript under its data usage policy. It needs a claude.ai login on a Pro, Max, Team or Enterprise plan; API keys are not supported, and on Team and Enterprise an Owner turns it on first.

Codex on mobile runs in the ChatGPT app for iOS and Android and connects to a host running the ChatGPT desktop app on macOS or Windows; setup cannot start from Codex CLI. To reach a Linux server, follow OpenAI's remote connections guide to add it as an SSH host under Settings > Connections, with codex installed, signed in and on the PATH of the remote user's login shell. On a ChatGPT workspace, an admin may need to turn on Remote Control access first. The desktop host has to stay awake and online.

How much RAM do Claude Code and Codex need on a server?

Anthropic lists 4 GB of RAM or more for Claude Code; OpenAI's install docs list 4 GB minimum and 8 GB recommended for Codex CLI. The models run on the vendors' servers, so server memory goes to the agent and the builds and tests it starts. For both agents on one server, the two minimums add up to 8 GB.

On Arct Cloud, the Cost Optimized plan cvm.micro and the General Purpose plan vm.micro (2 vCPU, 4 GB RAM, 40 GB NVMe) meet the 4 GB minimum, and cvm.small (4 vCPU, 8 GB RAM, 75 GB NVMe) and vm.tiny (4 vCPU, 8 GB RAM, 80 GB NVMe) have 8 GB. Sustained full-CPU load is not permitted, so start long builds and test suites on demand.

Run both in tmux on one server

Claude Code keeps its sign-in and settings in ~/.claude and ~/.claude.json, and Codex in ~/.codex, so both run under one unprivileged user. Each process ends with the SSH session unless it runs in tmux.

Give Codex its own git worktree on a separate branch, so the agents do not edit the same checkout. One committed AGENTS.md gives both agents the same project instructions when the repository has no CLAUDE.md. Sign in to each tool, then start both sessions in the background:

cd ~/projects/YOUR_REPO
git worktree add ../YOUR_REPO-codex -b codex-work
tmux new -d -s claude -c ~/projects/YOUR_REPO claude
tmux new -d -s codex -c ~/projects/YOUR_REPO-codex codex
tmux ls

Replace YOUR_REPO with the repository folder in ~/projects. The output looks similar to this:

claude: 1 windows (created Thu Oct 29 15:25:37 2026)
codex: 1 windows (created Thu Oct 29 15:25:37 2026)

Attach with tmux attach -t claude or tmux attach -t codex, detach with Ctrl+B, then D, and merge the codex-work branch when its task is done.

Route Claude Code and Codex through LiteLLM

A self-hosted LiteLLM Proxy puts model providers behind one endpoint with a virtual key per app.

  • Claude Code reads ANTHROPIC_BASE_URL (the gateway address) and ANTHROPIC_AUTH_TOKEN (a virtual key) from the env block in ~/.claude/settings.json. Usage is then billed per token instead of against a Claude plan, Anthropic supports only Claude models through a gateway, and Remote Control is unavailable while either variable is set.
  • Codex reads a custom provider from ~/.codex/config.toml: model_provider names it, and a [model_providers.<id>] table sets its base_url and the env_key variable that holds the key.

Which plans include Claude Code and Codex?

Claude Code needs a Claude Pro, Max, Team or Enterprise plan, or a Claude Console account billed for API usage; the free claude.ai plan does not include it. Anthropic's plans page lists the usage limits.

Codex CLI is included with ChatGPT Plus, Pro, Business, Edu and Enterprise. An OpenAI API key bills Codex at API rates, without cloud features such as Codex cloud tasks. OpenAI's Codex pricing page lists Codex on the Free and Go plans in the desktop app only, subject to rollout.

When to choose Claude Code

  • You want to steer a server session from the Claude app on iOS or Android, with no other computer in between.
  • You have a Claude Pro, Max, Team or Enterprise plan.
  • You want to install and update from a signed apt, dnf or apk repository.

When to choose Codex

  • You want shell commands sandboxed by default, with network access off.
  • You want an open-source agent under the Apache-2.0 license.
  • You have a ChatGPT Plus, Pro, Business, Edu or Enterprise plan, or want several model providers in config.toml.
  • You use the ChatGPT desktop app on a Mac or Windows PC and want phone access to server projects through it.

FAQ

Claude Code vs Codex: which is better?

Claude Code is the better fit for Remote Control from the Claude app on a Claude plan. Codex is the better fit for a sandbox that is on by default with network off, an open-source CLI, and ChatGPT plans or OpenAI API keys.

Codex vs Claude Code: which one has a sandbox on Linux?

Both use bubblewrap on Linux. Codex turns its sandbox on by default, with writes limited to the workspace and network access off. Claude Code's sandbox is off until you run /sandbox and covers shell commands only.

Can I run Claude Code and Codex on the same server?

Yes. They keep sign-in and settings apart, ~/.claude and ~/.claude.json for Claude Code and ~/.codex for Codex, and can share one AGENTS.md. Run each in its own tmux session and give Codex a separate git worktree.

How do I log in to Claude Code or Codex without a browser?

Run claude auth login, open the printed link on your computer, and paste back the code the browser shows. For Codex, turn on device code login in ChatGPT and run codex login --device-auth, or forward port 1455 with ssh -L 1455:localhost:1455 and run codex login.

Do Claude Code and Codex work with an API key?

Yes. Claude Code uses ANTHROPIC_API_KEY or a Console login, and Codex reads a key piped to codex login --with-api-key. With an API key, Claude Code has no Remote Control and Codex has no cloud tasks.

How much RAM do I need for Claude Code and Codex?

Anthropic lists 4 GB or more for Claude Code, and OpenAI lists 4 GB minimum and 8 GB recommended for Codex CLI. For both on one server, the two minimums add up to 8 GB, plus memory for builds and tests.

Does Claude Code Remote Control work through LiteLLM?

No. Remote Control needs an active claude.ai login and requests that go to api.anthropic.com. To use it, remove ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the env block in ~/.claude/settings.json and from the shell, then restart the session.

Next steps

Arct Cloud General Purpose plans run on AMD EPYC Milan 7003 Series processors up to 3.7 GHz with NVMe storage. Compare plans.