---
title: "Deploy Ubuntu VS Code Remote"
description: "Open VS Code Remote-SSH sessions on a persistent Ubuntu box"
category: "Starters"
url: https://railway.com/deploy/deploy-ubuntu-for-vs-code-remote-ssh
---

# Deploy Ubuntu VS Code Remote

Open VS Code Remote-SSH sessions on a persistent Ubuntu box

**[Deploy Ubuntu VS Code Remote on Railway](https://railway.com/template/deploy-ubuntu-for-vs-code-remote-ssh)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-ubuntu-for-vs-code-remote-ssh/manifest.json

- **Creator:** onepush
- **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 self hosted Ubuntu VS Code Remote (Remote Development on Railway Ubuntu) on Railway

This template gives you a persistent Ubuntu 26.04 box on Railway that desktop VS Code reaches through Remote-SSH and the Railway TCP proxy.

## About Hosting Ubuntu VS Code Remote open-source software on Railway (self hosted desktop VS Code Remote-SSH to a Railway Ubuntu box via the TCP proxy template)

This template runs one Ubuntu 26.04 service with sshd on port 2222, reached through a Railway TCP proxy host and random port, plus a ttyd web terminal on port 7681.

## Why Deploy Ubuntu VS Code Remote, the GitHub Codespaces alternative on Railway (Railway Free Trial)

GitHub Codespaces bills you for managed compute hours. Railway's $5 trial covers a small test, and you pay only Railway usage after that.

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 VS Code Remote 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.

### Railway vs Other Hosting Providers and VPS for Ubuntu VS Code Remote self hosting

Here is how this Railway box compares with renting a plain VM for Remote-SSH work. Your ~/.ssh/config points at the TCP proxy host and random port, not port 22.

| Provider | What You Get with Railway | What You Get with the Other Provider |
|---|---|---|
| DigitalOcean | A template deploy with /home persisted and key-only SSH wired up, but no root shell or systemd. | A full droplet with root and Docker, but you harden SSH and the firewall yourself. |
| AWS | One service with the TCP proxy and no networking setup. | Full control over VPCs and security groups, with more setup. |
| Hetzner | Managed deploys with a built-in TCP proxy and no server to provision. | Cheap servers with real inbound ports, suited to heavier work. |

Pick Railway for a quick VS Code Remote target, and a VPS when you need a true VM.

## Common Use Cases for hosted Ubuntu VS Code Remote

- **Running a Node or Python project on a persistent box:** Keep the project on the Railway Ubuntu service and open it from your laptop with Remote-SSH. The box stays up between sessions, so you skip reinstalling runtimes.
- **Forwarding a local dev server to your browser:** Run a server on port 3000 in the box and forward it with the Ports view or a LocalForward line in ~/.ssh/config. Then open localhost:3000 on your machine.
- **Keeping dotfiles and the VS Code server across redeploys:** Everything under /home survives a redeploy, including ~/.vscode-server. Apt packages do not, so put user-level tools in ~/.local.
- **Giving a teammate key-only access:** Add their public key to SSH_AUTHORIZED_KEYS and set SSH_PASSWORD_AUTH=false. They connect through the same proxy host and port with their own key.
- **Using Linux tooling you can't run natively:** When a build tool only targets Linux, run it in the Ubuntu box and edit files from desktop VS Code.

## Dependencies for Ubuntu VS Code Remote Docker hosted on Railway

This section covers what the Ubuntu service needs to run and how the pieces fit together.

### Deployment Dependencies for Managed Ubuntu VS Code Remote Service (ttyd + OpenSSH + tmux)

The service runs ttyd on port 7681 behind the public Railway domain with HTTP basic auth, sshd on port 2222 through the TCP proxy, and tmux for the shell session.

### Implementation Details for Ubuntu VS Code Remote (Using Ubuntu Web Terminal official docker image)

The image uses tini as PID 1 and a verified ttyd 1.7.7 static binary. ttyd runs su - ubuntu and then tmux new-session -A -s main, and interactive SSH logins auto-attach to the same session.

## How does Ubuntu VS Code Remote compare against other ways to run VS Code remotely on a hosted Ubuntu machine

Remote-SSH is the core idea: desktop VS Code connects to this Ubuntu box over the Railway TCP proxy, and the VS Code Server runs there. Each alternative below handles that job differently.

### Ubuntu VS Code Remote vs GitHub Codespaces (Cloud Dev Environment Alternative)

- **Ownership:** You get a plain Ubuntu container with sudo and your own dotfiles, not a workspace GitHub provisions for you.
- **Editor:** You connect the desktop VS Code you already run, with no browser editor to learn.
- **Where Codespaces wins:** Tight GitHub integration, prebuilds, and org policy are things this template does not match.

### Ubuntu VS Code Remote vs Gitpod (Cloud Dev Environment Alternative)

- **Persistence:** Only /home survives redeploys, so your VS Code Server install and shell history stay put.
- **Connection:** You add a ~/.ssh/config Host entry and connect like any SSH server.
- **Where Gitpod wins:** It builds workspaces from a repository automatically, while this box is a general machine you set up yourself.

### Ubuntu VS Code Remote vs code-server (Self Hosted Browser VS Code Alternative)

- **Desktop editor:** You keep native VS Code, its keybindings, and your local extensions instead of a browser tab.
- **Auth:** Key-only access with SSH_AUTHORIZED_KEYS and SSH_PASSWORD_AUTH=false keeps the editor off a web login.
- **Where code-server wins:** It runs in any browser with no local install and no SSH client setup.

### Ubuntu VS Code Remote vs DigitalOcean Droplet (Self Managed VPS Alternative)

- **Less upkeep:** Railway runs the container host, so you skip OS patching and manual firewall work.
- **Faster start:** Deploying the template gives you a working SSH endpoint without building a server.
- **Where a Droplet wins:** It is a full VM with systemd, Docker, inbound UDP, and apt installs that persist, none of which this container offers.

## How to use Ubuntu VS Code Remote (the OSS browser terminal and SSH box)?

1. Add SSH_AUTHORIZED_KEYS to the Ubuntu service with your public key(s), separated by semicolons. Set SSH_PASSWORD_AUTH=false, then redeploy.
2. Find the Railway TCP proxy host and random port that maps to the Ubuntu service's SSH port 2222.
3. Verify from a terminal with `ssh user@hostname`, where user is TERMINAL_USER and hostname is the proxy host.
4. Add a Host entry to ~/.ssh/config with HostName, Port (the random proxy port, not 22), User, and IdentityFile set:

```
Host ubuntu-box
    HostName something.proxy.rlwy.net
    Port 12345
    User ubuntu
    IdentityFile ~/.ssh/id_ed25519
```

5. In VS Code, press F1 (Ctrl+Shift+P on Linux, shift+cmd+P on macOS), choose Remote-SSH: Connect to Host..., and pick ubuntu-box. The VS Code server installs under ~/.vscode-server on the /home volume.
6. To forward a port, use the Ports view or Forward a Port from the command palette. For an always-on forward, add this line to the Host entry:

```
    LocalForward 127.0.0.1:3000 127.0.0.1:3000
```

## How to self host Ubuntu VS Code Remote on other VPS Services (Ubuntu Web Terminal self hosting guide)

### Clone the Repository

Grab the source from GitHub. The Dockerfile and entrypoint live at the repo root.

```bash
git clone https://github.com/onepush-dev/ubuntu-web-terminal.git
cd ubuntu-web-terminal
```

### Install Dependencies

You need Docker on the VPS, since the image is built on ubuntu:26.04 with tini as PID 1. Confirm the daemon is running, then build.

```bash
docker --version
docker build -t ubuntu-web-terminal .
```

### Configure Environment Variables

Set SSH_AUTHORIZED_KEYS to your public key(s), separated by semicolons, and turn off password SSH with SSH_PASSWORD_AUTH=false.

```bash
docker run -d --name ubuntu-vscode \
  -e SSH_AUTHORIZED_KEYS="ssh-ed25519 AAAA...your-key" \
  -e SSH_PASSWORD_AUTH=false \
  -e TERMINAL_PASSWORD="choose-a-long-secret" \
  -p 2222:2222 -p 7681:7681 \
  -v ubuntu-home:/home \
  ubuntu-web-terminal
```

### Start the Ubuntu VS Code Remote Application

Connect with ssh -p 2222 ubuntu@your-domain to confirm the login works.

Railway handles the TCP proxy, the persistent /home volume and the restart policy for you.

## Official Pricing of Ubuntu VS Code Remote (Ubuntu Web Terminal pricing)

Ubuntu VS Code Remote is free and open source, so there is no license fee to pay. You pay only for the Railway usage that the service consumes while it runs.

## Ubuntu VS Code Remote cloud vs self hosted comparison (Pricing, features, costs, and more)

Self hosting Ubuntu VS Code Remote on Railway means you pay Railway for usage while the software stays free. Your work lives in the persistent /home volume either way.

### Monthly cost of self hosting Ubuntu VS Code Remote on Railway

The template and all its software (ttyd, tmux, OpenSSH, and the Ubuntu base) are free. You pay only Railway usage for the single Ubuntu service and its volume.

### System Requirements for Hosting Ubuntu VS Code Remote on a VPS

Remote-SSH needs Ubuntu 16.04 or newer on x86_64, per the upstream docs. VS Code Server needs at least 1 GB of RAM, and 2 GB plus a 2-core CPU is the recommended floor.

## Frequently Asked Questions (FAQs)

### Do I need to copy my code to my laptop?

No. You edit them from desktop VS Code as if they were local.

### Why does the connection use a random port instead of 22?

Railway's TCP proxy forwards public traffic to sshd, which listens on port 2222 inside the container.

### How do I add or rotate SSH keys?

Set SSH_AUTHORIZED_KEYS on the Ubuntu service to one or more public keys separated by semicolons, and keep SSH_PASSWORD_AUTH=false.

### Does the VS Code server survive redeploys?

Yes, in practice. Anything installed with apt does not persist, so keep tooling in ~/.local.

### Why do git pushes hang with a passphrase key?

Upstream VS Code docs warn that passphrase-protected SSH keys can make pull and sync hang when run remotely.

### What does the Ubuntu box not support?

It is not a full VM.


## 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/deploy-ubuntu-for-vs-code-remote-ssh
