Deploy Ubuntu Dev Box
Ubuntu 26.04 dev box: SSH, web terminal, Claude Code, Codex. Persistent.
ubuntu-dev-box
Just deployed
/root
Deploy and Host an Ubuntu Dev Box on Railway
This template gives you an always-on Ubuntu 26.04 dev box with Claude Code and the OpenAI Codex CLI pre-installed. Open your Railway domain for a terminal in the browser, or SSH in through Railway's TCP proxy. Both land in the same tmux session, so a job you start from your laptop is still running when you reconnect from your phone. Your home directory lives on a volume, so repos, agent logins, GitHub auth and dotfiles survive every redeploy.
About Hosting an Ubuntu Dev Box
One service, one volume. The image ships claude, codex, git, gh, Node 24, Python 3 + uv, tmux, ripgrep, jq, vim, build tools and an OpenSSH server. A ttyd web terminal (basic-auth gated) and sshd (password or key) both drop you into the same tmux session. SSH host keys are stored on the volume, so your client never sees a "host key changed" warning after a redeploy. Both agents are optional: the box is a plain Ubuntu shell until you sign one in.
Common Use Cases
- Run Claude Code or Codex 24/7 on a task without keeping your laptop open
- Code from an iPad, Chromebook or phone: the browser terminal needs no SSH client
- A remote dev machine for VS Code Remote-SSH, Cursor or any editor that speaks SSH
- Keep a persistent workspace for side projects that is reachable from anywhere
Dependencies for Ubuntu Dev Box Hosting
- None. Single service, no database.
Deployment Dependencies
- Claude Code docs
- Codex CLI and its docs
- ttyd web terminal
- GitHub CLI
Implementation Details
First use: open your Railway domain and log in with WEB_USER and the generated WEB_PASSWORD (service Variables tab). You are in a tmux session named main; close the tab, reopen it, and everything is still there.
SSH: Railway creates a TCP proxy for port 22 on deploy. Copy the host and port from Settings → Networking and run ssh root@‹host› -p ‹port› with ROOT_PASSWORD, or add your public key to AUTHORIZED_KEYS and clear ROOT_PASSWORD for key-only login.
Sign the agents in (either, both or neither):
- Claude Code: run
claudeand complete/loginby pasting the URL into a browser. Or setCLAUDE_CODE_OAUTH_TOKEN(fromclaude setup-tokenon your own machine) orANTHROPIC_API_KEYas a service variable. - Codex: run
codex login --device-auth, open the URL it prints on any device and enter the code. Or setOPENAI_API_KEYas a service variable; the box saves it as Codex's login on every boot.
Handy commands inside the box:
clandcxstart Claude Code and Codex inside detachabletmuxsessions namedclaudeandcodex;tmux attach -t clauderesumes onegh auth loginor setGH_TOKENto push to GitHubapt install ‹pkg›works (you are root); anything outside/rootis gone after a redeploy
Notes and limits:
- You are root. Anything you install outside
/rootdisappears on redeploy; anything under/rootstays. New Claude Code and Codex versions arrive as template updates. - 0.5 GB of RAM runs the shell and both agents idle; give the service 1 GB or more when an agent builds Node or Python projects.
- Codex's own command sandbox (bubblewrap) cannot start in Railway's container, so the box writes
sandbox_mode = "danger-full-access"to~/.codex/config.tomlon first boot: Codex runs commands directly, and the container is the boundary. Edit that file to change it; it is never overwritten. - The same file turns off Codex's background app-server daemon (
daemon_auto_start = false). Its first start copies 424 MB into~/.codex/packagesand needs about 1 GB of memory, which a small service does not have. Set it totrueon a bigger service if you want remote control. - There is no Docker daemon inside the box.
- The web terminal password is the whole security model for a root shell. Keep it strong and do not share the URL.
Why Deploy an Ubuntu Dev Box on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying an Ubuntu dev box on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
ubuntu-dev-box
ghcr.io/two-workspaces/ubuntu-dev-box:077d521