What this gets you: Code on any device. AI agents running 24/7. One persistent workspace.
Cost: $16/month DigitalOcean droplet
Time: One afternoon
Go to: https://cloud.digitalocean.com/droplets/new
Settings:
- Image: Ubuntu 24.04 LTS
- Plan: Basic ($16/month)
- CPU: Regular, 2GB RAM / 1 CPU
- Datacenter: Pick closest to you
- Authentication: SSH keys (we'll create this next)
Don't create it yet. First, generate SSH keys.
Windows (PowerShell):
ssh-keygen -t ed25519 -C "your_email@example.com"Mac/Linux:
ssh-keygen -t ed25519 -C "your_email@example.com"Prompts:
- Where to save: Press Enter (default location)
- Passphrase: Choose a passphrase or press Enter (no passphrase)
Windows:
Get-Content "$env:USERPROFILE\.ssh\id_ed25519.pub"Mac/Linux:
cat ~/.ssh/id_ed25519.pubCopy the entire output (starts with ssh-ed25519 ...)
Back in DigitalOcean droplet creation:
- Click "New SSH Key"
- Paste your public key
- Name it (e.g., "my-laptop")
- Click "Add SSH Key"
Now create the droplet. Wait 60 seconds for it to spin up.
From DigitalOcean dashboard, copy your droplet's IPv4 address
Example: 206.189.12.245
ssh root@YOUR_DROPLET_IPType "yes" when asked about fingerprint.
apt update
apt upgrade -yIf you see a pink screen about services, press Tab → Enter (use default).
Replace cosmo with your username:
adduser cosmoEnter password when prompted. Press Enter through other prompts (or fill them in).
usermod -aG sudo cosmomkdir -p /home/cosmo/.ssh
cp /root/.ssh/authorized_keys /home/cosmo/.ssh/authorized_keys
chown -R cosmo:cosmo /home/cosmo/.ssh
chmod 700 /home/cosmo/.ssh
chmod 600 /home/cosmo/.ssh/authorized_keysOpen a NEW terminal window (keep root one open). Try:
ssh cosmo@YOUR_DROPLET_IPShould work without password. If it does, close root terminal.
Connect as your user (not root):
ssh cosmo@YOUR_DROPLET_IPsudo ufw allow OpenSSH
sudo ufw enableType "y" when prompted.
sudo ufw statusShould show: Status: active with OpenSSH allowed.
sudo apt install tmux -ynano ~/.tmux.confPaste this:
# Better colors + mouse support
set -g default-terminal "screen-256color"
set -g mouse on
# Faster key response
set -sg escape-time 0
# Bigger scrollback
set -g history-limit 100000
# Easier pane navigation
setw -g mode-keys vi
Save: Ctrl+O → Enter → Ctrl+X
mkdir -p ~/repos/work ~/repos/side ~/repos/playground
mkdir -p ~/bin
mkdir -p ~/tmpnano ~/.bashrcAdd at the end:
# Add local bin to PATH
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
# Auto-attach tmux on SSH login
if [ -n "$SSH_CONNECTION" ] && [ -z "$TMUX" ]; then
tmux attach -t main || tmux new -s main
fiSave: Ctrl+O → Enter → Ctrl+X
nano ~/bin/taPaste:
#!/usr/bin/env bash
tmux attach -t main || tmux new -s mainSave and exit.
nano ~/bin/tdPaste:
#!/usr/bin/env bash
tmux detachSave and exit.
Make them executable:
chmod +x ~/bin/ta ~/bin/tdsource ~/.bashrcYour VPS needs to access GitHub to clone repos.
ssh-keygen -t ed25519 -C "your_email@example.com"Press Enter for all prompts (default location, no passphrase).
cat ~/.ssh/id_ed25519.pubCopy the entire output.
- Go to: https://github.com/settings/keys
- Click "New SSH key"
- Title: "VPS - Rawdog Dev"
- Paste the key
- Click "Add SSH key"
ssh -T git@github.comType "yes" when prompted.
Should see: Hi username! You've successfully authenticated...
curl -fsSL https://cli.openai.com/install.sh | shFollow the prompts.
Authentication:
If device-code auth doesn't work, do this on your laptop:
Windows:
scp -i "$env:USERPROFILE\.ssh\id_ed25519" "$env:USERPROFILE\.codex\auth.json" cosmo@YOUR_DROPLET_IP:~/.codex/auth.jsonMac/Linux:
scp ~/.codex/auth.json cosmo@YOUR_DROPLET_IP:~/.codex/auth.jsonpip install factory-cliOr:
curl -fsSL https://factory.ai/install.sh | sh(Check Factory AI docs for latest install method)
Test it:
droid --versionIf not found, make sure PATH is set:
export PATH="$HOME/.local/bin:$PATH"Or create symlink:
ln -s ~/.local/bin/droid ~/bin/droidcd ~/repos/side(or ~/repos/work for work projects)
git clone git@github.com:yourusername/yourrepo.git
cd yourrepocodexShould open Codex in your repo.
droidShould start Factory droid session.
iOS: https://apps.apple.com/app/termius/id549039908 Android: https://play.google.com/store/apps/details?id=com.server.auditor.ssh.client
- Open Termius → New Host
- Label: "Rawdog VPS"
- Hostname: Your droplet IP
- Username: cosmo (your username)
- Port: 22
- In Termius → Settings → Keychain
- Tap "+" → Import
- On laptop, find your SSH private key:
- Windows:
C:\Users\YourName\.ssh\id_ed25519 - Mac/Linux:
~/.ssh/id_ed25519
- Windows:
- Transfer it to your phone (AirDrop, email to yourself, etc.)
- Import the file (NOT the .pub file)
- Enter passphrase if you set one
- Edit your host in Termius
- Keys: Select the key you just imported
- Save
Tap your host. Should connect without password.
You'll automatically land in tmux session main.
ssh cosmo@YOUR_DROPLET_IPAuto-lands in tmux main.
Start coding:
cd ~/repos/side/yourrepo
codexWhen done, detach:
tmux detachOr press: Ctrl+b then d
Or just close terminal.
Open Termius → Connect to your host
Run:
tmux attach -t mainOr use shortcut:
taYou're exactly where you left off on laptop. Same cursor position. Same everything.
ssh cosmo@YOUR_DROPLET_IPAuto-attaches to tmux main.
cd ~/repos/work/project-namecodex # For OpenAI Codex
droid # For Factory AI droidstmux detach # Or use: tdtmux attach -t main # Or use: tatmux lstmux kill-session -t main
tmux new -s mainssh cosmo@YOUR_DROPLET_IP # Connect from anywheretmux new -s main # Create session
tmux attach -t main # Attach to session
tmux detach # Detach (keep running)
tmux ls # List sessions
tmux kill-session -t main # Kill sessioncd ~/repos/work # Work projects
cd ~/repos/side # Side projects
cd ~/repos/playground # Experimentscodex # OpenAI Codex
droid # Factory AI droidsgit clone git@github.com:user/repo.git
git status
git add .
git commit -m "message"
git push- Check droplet IP is correct
- Verify SSH key is in
~/.ssh/authorized_keyson server - Try:
ssh -v cosmo@YOUR_IPfor debug info
- Make sure you're using the right username
- Verify SSH key permissions on laptop:
chmod 600 ~/.ssh/id_ed25519 - Check
~/.ssh/authorized_keysexists on server
- Check
~/.bashrchas the auto-attach code - Run:
source ~/.bashrc - Log out and back in
- Check PATH:
echo $PATHshould include/home/yourusername/.local/bin - Add to current session:
export PATH="$HOME/.local/bin:$PATH" - Or create symlink:
ln -s ~/.local/bin/droid ~/bin/droid - Restart tmux:
tmux kill-serverthen reconnect
- Don't run
tmuxinside tmux - Check if you're in tmux:
echo $TMUX - Detach properly before creating new session
- Test SSH:
ssh -T git@github.com - Verify SSH key added to GitHub
- Check key permissions:
chmod 600 ~/.ssh/id_ed25519
✅ $16/month VPS running Ubuntu ✅ Secure SSH access from laptop + phone ✅ tmux persistent sessions (never lose work) ✅ Directory structure (work/side/playground) ✅ GitHub access from VPS ✅ OpenAI Codex running 24/7 ✅ Factory AI droids running 24/7 ✅ Cross-device coding (same session everywhere)
Your code lives in one place. Your agents live in one place. You access them from anywhere.
The device is now irrelevant.
- Clone your repos to
~/repos/ - Test cross-device (laptop → phone → same session)
- Set up shortcuts in your terminal (aliases, functions)
- Install other tools you need (Node, Python, Docker, etc.)
- Configure Nginx if you want to host web apps
This is the foundation. Everything else builds on this.
Setup inspired by @levelsio's "rawdog dev on the server" approach.
AI agents: OpenAI Codex + Factory AI
Questions? Issues?
DM me: @cosmo_kappa
I'm documenting this publicly. If something breaks, I want to know so I can update this guide.
Last Updated: 2026-01-15 Version: 1.0 Tested on: Ubuntu 24.04 LTS, DigitalOcean Droplet