---
title: "Deploy Ubuntu Cloud Shell"
description: "Ubuntu 26.04 shell in your browser and over SSH, with a persistent home."
category: "Starters"
url: https://railway.com/deploy/ubuntu-cloud-shell
---

# Deploy Ubuntu Cloud Shell

Ubuntu 26.04 shell in your browser and over SSH, with a persistent home.

**[Deploy Ubuntu Cloud Shell on Railway](https://railway.com/template/ubuntu-cloud-shell)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/ubuntu-cloud-shell/manifest.json

- **Creator:** blueorange
- **Category:** Starters

## Template content

### Ubuntu https://github.com/ubuntu.png

- **Image:** ghcr.io/onepush-dev/ubuntu-web-terminal:26.04-ttyd1.7.7
- **Public domain:** Yes

## Documentation

# Deploy and Host Ubuntu Cloud Shell on Railway

![Ubuntu logo](https://github.com/ubuntu.png)

This template gives you a **persistent Ubuntu 26.04 LTS box you can reach from any browser or over SSH**. The web terminal is served by ttyd, the MIT-licensed terminal-over-HTTP tool with about 12,600 GitHub stars, and OpenSSH listens behind a Railway TCP proxy. Both land in the same tmux session, so a job you start on your phone is still running when you SSH in from your laptop. Your home directory lives on a volume, a 24-character password is generated for every deploy, and sudo, git, curl, jq, vim, htop and rsync are already installed. It's a lightweight alternative to GitHub Codespaces or a small VPS for long-running scripts, CLI tools and a bastion inside your Railway project. Expect about $1–5/month on Railway for an idle shell, since you pay only for the CPU and memory it actually uses.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **Ubuntu** | The `ghcr.io/onepush-dev/ubuntu-web-terminal:26.04-ttyd1.7.7` image. ttyd on port `7681` behind a public HTTPS domain, and sshd on port `2222` behind a Railway TCP proxy. |
| **Volume** | Mounted at `/home`. Holds your files, dotfiles, shell history, tools in `~/.local` and the SSH host keys. |

The image is built on a pinned Ubuntu 26.04 base, and the ttyd binary is checked against its SHA-256 during the build. Root login over SSH is disabled, and only the terminal user can sign in.

---

## About Hosting an Ubuntu Shell on Railway

Sometimes you just need a Linux prompt that keeps running: a long data sync, a scraper, a CLI that needs credentials you don't want on your laptop, or a place to test commands without breaking your machine. A full VPS is more than you need for that, and managed dev environments stop when you close the tab.

**Browser and SSH, one session.** The browser terminal attaches to the tmux session `main`. Interactive SSH logins attach to the same session when `TMUX_AUTO_ATTACH` is on. Close the tab, open it again tomorrow, and the window is where you left it.

**What persists.** Everything under `/home` survives redeploys and restarts, including the SSH host keys, so the server fingerprint stays stable and your SSH client won't warn you. Packages installed with `apt` live in the container layer and disappear on the next deploy. Put tools in `~/.local/bin`, use pip or npm user installs, or fork the Dockerfile to bake packages in.

**What it isn't.** This is a container, not a virtual machine. There is no systemd, no Docker inside it, and no inbound UDP. For those, pick a VPS.

**Sizing.** An idle shell uses very little memory. Railway lets the container use more CPU and RAM, up to your plan's limits, when a build or script needs it, so you don't pick a server size in advance.

**Lock it down.** The password protects both the web terminal and SSH, and the user has passwordless sudo by default. Anyone with the URL and password has root-level control of the box, so treat the password like an SSH key. Add your public keys and turn off password SSH once you're set up.

Typical cost: **~$1–5/month** on Railway while mostly idle, more if you run heavy jobs. GitHub Codespaces bills a 2-core machine at $0.18 per hour after the free allowance.

---

## Deploy Ubuntu Cloud Shell in Under 2 Minutes

1. Click **Deploy on Railway**. There's nothing to fill in; the service starts in under a minute.
2. Copy `TERMINAL_PASSWORD` from the service's **Variables** tab.
3. Open the public URL and sign in as `ubuntu` with that password.
4. For SSH, find the TCP proxy host and port under **Settings** and **Networking**, then run `ssh -p PORT ubuntu@HOST`.
5. Start a long job, close the browser, and check on it later from either side.

That's it: a persistent Ubuntu prompt you can reach from anywhere.

---

## Common Use Cases

- **Long-running jobs.** Run syncs, builds or scrapers in tmux and close your laptop.
- **A shell from an iPad or locked-down PC.** Get a full Ubuntu prompt with sudo where you can't install an SSH client.
- **Bastion for your Railway project.** Reach private services over Railway's internal network to debug them without exposing them publicly.
- **CLI tools with a home.** Keep cloud CLIs, credentials and scripts in one place instead of on every machine.
- **Teaching and workshops.** Give each student a URL and password for a clean Linux box to practise on.
- **Pair debugging.** Two people can watch and type in the same tmux session at once.
- **Testing install scripts.** Try a script or package on clean Ubuntu, then redeploy to reset everything outside `/home`.
- **Dotfiles lab.** Try new shell, editor or prompt settings without touching your own machine.
- **Cron-style scripts.** Leave a loop or a scheduler running in a tmux window for small recurring tasks.

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `TERMINAL_PASSWORD` | 🔐 Auto-generated | 24-character password for the web terminal and SSH. Change it and redeploy to rotate. |
| `TERMINAL_USER` | ✅ Set | `ubuntu`. Any other name is created on start. |
| `SSH_PASSWORD_AUTH` | ✅ Set | `true`. Set `false` for key-only SSH after adding keys. |
| `SUDO_NOPASSWD` | ✅ Set | `true`, passwordless sudo for the terminal user. |
| `TMUX_SESSION`, `TMUX_AUTO_ATTACH` | ✅ Set | `main` and `true`, so browser and SSH share one session. |
| `PORT`, `SSH_PORT` | ✅ Set | `7681` for ttyd and `2222` for sshd. |
| `TERMINAL_TITLE`, `TTYD_FONT_SIZE` | ✅ Set | Browser tab title and font size. |
| `TTYD_MAX_CLIENTS` | ✅ Set | `0`, no limit on simultaneous browser clients. |
| `TZ` | ✅ Set | `UTC`. Set your own timezone for local timestamps. |

**SSH keys.** Add an optional `SSH_AUTHORIZED_KEYS` variable with one or more public keys separated by semicolons, redeploy, then set `SSH_PASSWORD_AUTH=false`.

**Timezone.** Set `TZ` to a zone such as `Europe/Berlin` so `date`, logs and scheduled loops use local time.

**Sharing access.** For a workshop, deploy one box per person instead of sharing a password; everyone who signs in to a box gets the same sudo rights.

**Private network.** Other services in the same project are reachable by their `.railway.internal` hostnames, which makes this box a handy place to run `psql`, `redis-cli` or `curl` against them.

---

## Ubuntu Cloud Shell vs. Alternatives

| | Ubuntu on Railway | GitHub Codespaces | Google Cloud Shell | Small VPS |
|---|---|---|---|---|
| **Monthly cost** | ~$1–5 usage | Free hours, then per hour | Free | From a few dollars |
| **Always on** | ✅ Yes | ❌ Stops when idle | ❌ Session-based | ✅ Yes |
| **Browser terminal** | ✅ Yes | ✅ VS Code | ✅ Yes | ❌ Set it up yourself |
| **SSH access** | ✅ Yes | ⚠️ Through GitHub CLI | ⚠️ Through gcloud | ✅ Yes |
| **Shared tmux session** | ✅ Built in | ❌ No | ❌ No | ⚠️ Manual |
| **Persistent home** | ✅ Volume | ✅ Per codespace | ✅ 5 GB | ✅ Disk |
| **Server admin needed** | ✅ None | ✅ None | ✅ None | ❌ Updates and firewall |

---

## Dependencies for Ubuntu Cloud Shell Hosting

- Railway account. Hobby is enough; Pro for more RAM and CPU.
- An SSH client if you want SSH access. The browser terminal needs nothing.

### Deployment Dependencies

- [ubuntu-web-terminal on GitHub](https://github.com/onepush-dev/ubuntu-web-terminal): Dockerfile and scripts, MIT
- [ttyd on GitHub](https://github.com/tsl0922/ttyd): the web terminal
- [Railway TCP Proxy](https://docs.railway.com/guides/public-networking): how SSH reaches the box
- [Railway Volumes](https://docs.railway.com/volumes): persistence for `/home`

### Implementation Details

The image is pinned to Ubuntu 26.04 and ttyd 1.7.7, so redeploys rebuild the same environment. Railway terminates TLS for the browser terminal, and SSH traffic is encrypted end to end by SSH itself. There is no HTTP health check, because every path requires the login. Ubuntu is a trademark of Canonical; the template code is MIT.

The restart policy is set to always, so if the container exits, Railway starts it again and tmux comes back with a fresh `main` session. Processes running inside tmux don't survive a restart or redeploy, so save work to `/home` as you go.

---

## Frequently Asked Questions

**What do I get?**
A persistent Ubuntu 26.04 LTS shell you can open in a browser or over SSH, both sharing one tmux session, with `/home` on a volume.

**How much does it cost?**
About $1–5/month on Railway when mostly idle, because billing follows actual CPU and memory use. Heavy builds cost more while they run.

**Where is the password?**
In the service's **Variables** tab as `TERMINAL_PASSWORD`. It's generated for each deploy; change it and redeploy to rotate.

**Why did my installed packages disappear?**
Only `/home` persists. Install tools into `~/.local`, or fork the Dockerfile and add them to the image.

**Can I run Docker or systemd services?**
No. It's a container without systemd or Docker. Run processes in tmux, or use a VPS for full system control.

**How do I use SSH keys only?**
Add `SSH_AUTHORIZED_KEYS` with your public keys, redeploy, confirm key login works, then set `SSH_PASSWORD_AUTH` to `false`.

---

## Why Deploy and Host Ubuntu Cloud Shell 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 Ubuntu Cloud Shell on Railway, you get an always-on Linux prompt in your browser and over SSH, with a persistent home and no server to maintain.


## Similar templates

- [Openfront Gym](https://railway.com/deploy/openfront-gym) — Opensource Mindbody alternative based on Next.js and Keystone.js
- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [Next.js + Prisma + PostgreSQL Starter](https://railway.com/deploy/nextjs-prisma-postgres) — Deploy a Next.js app with Prisma ORM and PostgreSQL in one click.

Open this page in a browser: https://railway.com/deploy/ubuntu-cloud-shell
