DigitalOcean Cloud Setup - Complete Guide
March 7, 2026 · View on GitHub
Set up Claude Code collaboration using DigitalOcean in about 60 minutes.
Cost: $12/month (split between collaborators = $6/each) Benefit: No port forwarding, works from anywhere, automatic user prefixing
TL;DR (5 commands)
If you know what you're doing, here's the fast path:
# 1. Create a DigitalOcean Droplet (Ubuntu 22.04, \$12/mo, with your SSH key)
# 2. Bootstrap the server:
scp server-bootstrap.sh root@YOUR_SERVER_IP:/tmp/
ssh root@YOUR_SERVER_IP 'bash /tmp/server-bootstrap.sh'
# ↑ Auto-generates a password and prints collaborator instructions
# Use --password CUSTOM to set your own password
# 3. SSH in, authenticate Claude Code, start it in the tmux session:
ssh claudeteam@YOUR_SERVER_IP
tmux attach-session -t claude-collab
claude
# Ctrl+B, D to detach
# 4. Add your collaborator:
add-collaborator.sh YOUR_SERVER_IP "ssh-ed25519 AAAA...their-key..."
# 5. Connect:
join-claude-session-split.sh host YOUR_SERVER_IP claudeteam claude-collab
New to this? Follow the step-by-step guide below.
What You'll Build
Your Mac ──SSH──► DigitalOcean Droplet ◄──SSH── Collaborator
(Ubuntu Server)
running Claude Code
with tmux session
↓
Automatic [username] prefixing
Split-screen interface
Prerequisites
- Credit card (for DigitalOcean)
- 60 minutes
- Basic terminal familiarity
New to DigitalOcean? Get $200 credit (60 days free): https://www.digitalocean.com/
Part 1: Create SSH Key (5 minutes)
On Your Mac
Check if you already have an SSH key:
# Check for ED25519 (modern, recommended)
ls ~/.ssh/id_ed25519.pub
# OR check for RSA (older but common)
ls ~/.ssh/id_rsa.pub
If you have either one, skip to displaying your key below.
If you see "No such file" for both, create one:
# Modern ED25519 key (recommended)
ssh-keygen -t ed25519 -C "your-email@example.com"
# OR traditional RSA key (if ED25519 not supported)
ssh-keygen -t rsa -b 4096 -C "your-email@example.com"
Press Enter for all prompts (accept defaults):
- File location: (just press Enter)
- Passphrase: (press Enter for no passphrase, or set one)
Display your public key:
# If you have ED25519:
cat ~/.ssh/id_ed25519.pub
# OR if you have RSA:
cat ~/.ssh/id_rsa.pub
You'll see something like:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... your-email@example.com
# OR
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC... your-email@example.com
Copy this entire line. You'll need it in the next step.
Note: ED25519 and RSA are different key types. Make sure you copy the PUBLIC key (
.pubfile) that you're actually using.
Part 2: Create DigitalOcean Droplet (10 minutes)
Step 1: Sign Up for DigitalOcean
- Go to https://www.digitalocean.com/
- Click "Sign Up"
- Create account with email or GitHub
- Add payment method (get $200 credit if new user)
Step 2: Create Droplet
-
Click "Create" (top right) → "Droplets"
-
Choose Region:
- Select closest to you and your collaborator
- Recommendation: San Francisco 3 or New York 1
-
Choose Image:
- Click "Ubuntu"
- Select "22.04 (LTS) x64"
-
Choose Size:
- Click "Basic" plan
- CPU option: "Regular"
- Scroll to find: $12/mo option
- 2 GB RAM / 1 CPU
- 50 GB SSD
- 2 TB Transfer
- Click this option
-
Choose Authentication Method:
- Click "SSH Key" (recommended)
- Click "New SSH Key"
- Paste your public key (from Part 1)
- Name it: "My Mac" or "Your Name Mac"
- Click "Add SSH Key"
-
Finalize Details:
- Hostname:
claude-collab-server - Tags: (optional) add
collaboration - Project: Default Project (or create new)
- Leave other options as default
- Hostname:
-
Click "Create Droplet"
Step 3: Get Your Droplet's IP Address
After 1-2 minutes, your droplet will be ready.
You'll see a screen showing:
- Droplet name: claude-collab-server
- IP address: Something like
164.92.123.456
Write down this IP address - you'll need it throughout setup.
Part 3: Initial Server Connection (2 minutes)
Test Connection
Open Terminal on your Mac and run:
ssh root@164.92.123.456
Replace 164.92.123.456 with your actual IP address
First time connecting: You'll see a message like:
The authenticity of host '164.92.123.456' can't be established.
ECDSA key fingerprint is SHA256:...
Are you sure you want to continue connecting (yes/no)?
Type: yes and press Enter
You should see:
Welcome to Ubuntu 22.04 LTS
...
root@claude-collab-server:~#
You're now connected to your cloud server!
Part 4: Server Setup (20 minutes)
Step 1: Create Collaboration User
# Create a user for collaboration
adduser claudeteam
You'll be prompted:
- Password: Choose a strong password (write it down)
- Full Name: (press Enter to skip)
- Room Number, etc.: (press Enter to skip all)
- Is this correct? Type
Y
# Give sudo privileges
usermod -aG sudo claudeteam
# Switch to new user
su - claudeteam
You're now the claudeteam user. The prompt changes to:
claudeteam@claude-collab-server:~$
Step 2: Set Up SSH Keys for Collaboration User
# Create SSH directory
mkdir -p ~/.ssh
chmod 700 ~/.ssh
# Create authorized keys file
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Now add SSH keys:
nano ~/.ssh/authorized_keys
This opens a text editor. Paste:
- Your public key (from Part 1)
- Get your collaborator's public key and paste it on a NEW line
- Have them run on their machine:
cat ~/.ssh/id_rsa.pub - They send you the output
- Paste it on line 2
- Have them run on their machine:
Example file contents:
ssh-rsa AAAAB3...your_key_here... you@yourmac
ssh-rsa AAAAB3...collab_key_here... collab@theirmac
Save and exit:
- Press:
Ctrl + X - Press:
Y(to confirm save) - Press:
Enter(to confirm filename)
Step 3: Update System
sudo apt update && sudo apt upgrade -y
Enter the password you created for claudeteam.
This takes 2-5 minutes. Wait for it to complete.
Step 4: Install tmux
sudo apt install -y tmux git curl
Verify:
tmux -V
Should show: tmux 3.2a or similar
Step 5: Install Node.js
Claude Code requires Node.js:
# Add Node.js repository
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
# Install Node.js
sudo apt install -y nodejs
# Verify installation
node --version
npm --version
Should show:
v20.x.x
10.x.x
Step 6: Install Claude Code
# Install Claude Code CLI globally
npm install -g @anthropic-ai/claude-code
# Verify installation
claude-code --version
Should show the version number.
Step 7: Authenticate Claude Code
claude-code auth login
You'll see:
Please visit the following URL to authenticate:
https://claude.ai/auth/some-unique-url
Copy this URL and paste it into your web browser.
- Log in to your Claude account
- Click "Authorize"
- Return to your terminal
You should see:
Authentication successful!
Step 8: Test Claude Code
claude-code
Wait for it to start (10-20 seconds).
When you see the Claude Code prompt, type:
What is 2+2?
If Claude responds with "4", you're good!
Exit Claude Code:
exit
Or press Ctrl + D
Part 5: Install Collaboration Script (10 minutes)
Step 1: Clone Repository on Server
Still as claudeteam user on the server:
cd ~
git clone https://github.com/jxandery/claude-code-collab.git
cd claude-code-collab
Step 2: Install Script
./install.sh
You'll see:
✓ Added ~/bin to PATH in /home/claudeteam/.bashrc
Reload your shell:
source ~/.bashrc
Verify installation:
which join-claude-session.sh
Should show: /home/claudeteam/bin/join-claude-session.sh
Step 3: Create Shared tmux Session
# Create a detached tmux session
tmux new-session -s claude-collab -d
# Start Claude Code in the session
tmux send-keys -t claude-collab "claude-code" C-m
# Wait a moment for Claude Code to start
sleep 5
# Verify session is running
tmux ls
Should show:
claude-collab: 1 windows (created ...)
Perfect! The session is running in the background.
Step 4: Exit Server
exit # Exit from claudeteam user
exit # Exit from root user
You're back on your local Mac.
The tmux session with Claude Code is still running on the server!
Part 6: Set Up Your Local Mac (10 minutes)
Step 1: Clone Repository Locally
On your Mac:
cd ~
git clone https://github.com/jxandery/claude-code-collab.git
cd claude-code-collab
Step 2: Install Script Locally
./install.sh
Reload your shell:
source ~/.zshrc
# Or if you use bash: source ~/.bashrc
Verify:
which join-claude-session.sh
Should show: /Users/yourname/bin/join-claude-session.sh
Step 3: Test SSH Connection
ssh claudeteam@164.92.123.456
Replace with your server's IP
If prompted for password, enter the claudeteam password you created.
If it asks for password and you don't want to type it every time:
Run this on your Mac:
ssh-copy-id claudeteam@164.92.123.456
Now try again - should connect without password!
Once connected:
# Verify tmux session
tmux ls
# Should show: claude-collab
Exit:
exit
Part 7: Join Collaboration Session (5 minutes)
Choose Your Mode
You have two options for joining the collaboration session:
Option A: Split-Pane Mode (Recommended)
- See both Claude's responses AND your input in ONE terminal window
- Easier to use, better experience
- Runs from your local Mac
Option B: Two-Terminal Mode
- Input in one terminal, view responses in another
- Good if you prefer separate windows
Option A: Split-Pane Mode (Recommended)
From your Mac (NOT on the server):
join-claude-session-split.sh host 68.183.159.246 claudeteam claude-collab
# Or with a custom display prefix:
join-claude-session-split.sh host 68.183.159.246 claudeteam claude-collab --prefix JY
You'll see a split screen:
┌─────────────────────────────────────┐
│ TOP (70%): Claude Code Output │
│ │
│ [host] What is 2+2? │
│ Claude: 2+2 equals 4 │
│ │
├─────────────────────────────────────┤
│ BOTTOM (30%): Your Input │
│ [host]> _ │
└─────────────────────────────────────┘
That's it! Everything in one window.
To exit:
- Press
Ctrl+Cto stop the input loop - Press
Ctrl+B, thenDto detach from tmux
Option B: Two-Terminal Mode
Terminal 1 - Your Input:
From your Mac, SSH to the server first:
ssh claudeteam@68.183.159.246
Then run (IMPORTANT: This runs ON the server):
join-claude-session.sh host claude-collab
You'll see:
[host]> _
Terminal 2 - View Claude's Responses:
Open a second terminal on your Mac:
ssh claudeteam@68.183.159.246
tmux attach-session -r -t claude-collab
You'll see Claude Code running with all interactions.
Try It Out
Using whichever mode you chose, type:
What is 2+2?
You should see in the top pane:
[host] What is 2+2?
Claude: 2 + 2 equals 4.
Success! The [host] prefix was added automatically!
Exit the Session
Press: Ctrl + B, then press D
This detaches from the session (it keeps running).
Type exit to disconnect from SSH.
Part 8: Add Your Collaborator (5 minutes)
Option A: Self-Service (Easiest)
Set a password on the claudeteam account so collaborators can add their own SSH key:
# On the server (as root):
ssh root@164.92.123.456
echo 'claudeteam:YOUR_CHOSEN_PASSWORD' | chpasswd
# Enable password auth for ssh-copy-id:
sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
systemctl restart sshd
exit
Then share this with your collaborator:
Server IP: 164.92.123.456
Username: claudeteam
Password: YOUR_CHOSEN_PASSWORD (for one-time SSH key setup)
Session name: claude-collab
Repository: https://github.com/jxandery/claude-code-collab
Your collaborator runs:
# 1. Add their SSH key (enter password once):
ssh-copy-id claudeteam@164.92.123.456
# 2. Clone and install scripts:
git clone https://github.com/jxandery/claude-code-collab.git
cd claude-code-collab
./install.sh
source ~/.zshrc # or ~/.bashrc
# 3. Join session:
join-claude-session-split.sh collaborator 164.92.123.456 claudeteam claude-collab
Option B: Manual Key Addition
If you prefer not to enable password auth, have your collaborator send you their public key:
# Collaborator runs:
cat ~/.ssh/id_ed25519.pub # or ~/.ssh/id_rsa.pub
Then add it using the helper script:
add-collaborator.sh 164.92.123.456 "ssh-ed25519 AAAA...their-key..."
Part 9: Start Collaborating!
Both of you connect:
Host:
ssh claudeteam@164.92.123.456
join-claude-session.sh host claude-collab
Collaborator:
ssh claudeteam@164.92.123.456
join-claude-session.sh collaborator claude-collab
Example Session:
Host types in bottom pane:
Create a function to validate email addresses
Both see in top pane:
[host] Create a function to validate email addresses
Claude: I'll create an email validation function...
Collaborator types in their bottom pane:
Can we also add phone validation?
Both see in top pane:
[collaborator] Can we also add phone validation?
Claude: Absolutely! Let me add phone validation too...
Magic! 🎉
Managing Your Server
Check if Claude Code Session is Running
ssh claudeteam@YOUR_SERVER_IP
tmux ls
Should show:
claude-collab: 1 windows (created ...)
Restart Claude Code Session (if needed)
ssh claudeteam@YOUR_SERVER_IP
# Kill old session
tmux kill-session -t claude-collab
# Create new session
tmux new-session -s claude-collab -d
tmux send-keys -t claude-collab "claude-code" C-m
View Session Directly (Troubleshooting)
ssh claudeteam@YOUR_SERVER_IP
# Attach to session
tmux attach-session -t claude-collab
# You'll see Claude Code running
# To detach: Ctrl+B, then D
Troubleshooting
"Connection refused" when SSH
Check droplet is running:
- Log into DigitalOcean dashboard
- Click "Droplets"
- Verify status is "Active" (green dot)
Check IP address:
- Make sure you're using the correct IP from DigitalOcean dashboard
"Permission denied (publickey)"
Your SSH key isn't on the server, or you're using the wrong key type.
Step 1: Identify which key you're using
On your local machine, run:
ssh -v claudeteam@YOUR_SERVER_IP 2>&1 | grep "Offering public key"
Look for a line like:
Offering public key: /Users/you/.ssh/id_ed25519 ED25519
# OR
Offering public key: /Users/you/.ssh/id_rsa RSA
Step 2: Get the correct public key
# If using ED25519:
cat ~/.ssh/id_ed25519.pub
# If using RSA:
cat ~/.ssh/id_rsa.pub
Copy the entire output.
Step 3: Add it to the server
# Connect with password (if you set one) or as root
ssh claudeteam@YOUR_SERVER_IP
# OR
ssh root@YOUR_SERVER_IP
su - claudeteam
# Edit authorized_keys
nano ~/.ssh/authorized_keys
# Paste your public key on a new line
# Make sure it's all ONE line (no line breaks in the middle)
# Save: Ctrl+X, Y, Enter
# Fix permissions if needed
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
# Exit and try again
exit
ssh claudeteam@YOUR_SERVER_IP # Should work now
Common Issues:
- Using ED25519 key but added RSA key to server (or vice versa)
- Key was split across multiple lines when pasted
- Wrong permissions on
.sshdirectory orauthorized_keysfile - Pasted the private key instead of public key
"No session found: claude-collab"
Session isn't running.
Fix:
ssh claudeteam@YOUR_SERVER_IP
# Create session
tmux new-session -s claude-collab -d
tmux send-keys -t claude-collab "claude-code" C-m
Claude Code not responding
Restart it:
ssh claudeteam@YOUR_SERVER_IP
# Kill session
tmux kill-session -t claude-collab
# Start fresh
tmux new-session -s claude-collab -d
tmux send-keys -t claude-collab "claude-code" C-m
Can't find join-claude-session.sh
Reinstall script:
cd ~/claude-code-collab
./install.sh
source ~/.zshrc
Run the diagnostic tool
For a comprehensive check of your setup:
diagnose.sh YOUR_SERVER_IP
Reconnecting After Disconnection
If your laptop sleeps, WiFi drops, or you close the terminal — the session is NOT lost. The tmux session keeps running on the server.
To reconnect, just run the join command again:
join-claude-session-split.sh YourName YOUR_SERVER_IP claudeteam claude-collab
All history is preserved. You'll see everything that happened while you were disconnected.
When You're Done
End a collaboration session
# Clean up everything:
teardown.sh YOUR_SERVER_IP
Stop paying for the server
- Go to https://cloud.digitalocean.com/droplets
- Click your droplet name
- Click Destroy tab
- Confirm destruction
Billing stops immediately. You'll need to set up from scratch if you want to collaborate again.
Cost & Billing
Monthly Cost
DigitalOcean Basic Droplet:
- $12/month ($0.018/hour)
- 2 GB RAM
- 1 CPU
- 50 GB SSD
- 2 TB transfer
Split between 2 people: $6/month each
New User Credit
- $200 credit for 60 days
- First 60 days are FREE!
- Cancel anytime before credit runs out
Monitoring Costs
- Log into DigitalOcean
- Click "Billing" in left menu
- See month-to-date usage
Destroying the Droplet (to save money)
If you want to pause and not pay:
- DigitalOcean dashboard
- Click "Droplets"
- Click droplet name
- Click "Destroy"
- Type droplet name to confirm
Note: This deletes everything! You'll need to set up from scratch again.
Security Best Practices
Disable Password Authentication (Use SSH Keys Only)
ssh claudeteam@YOUR_SERVER_IP
sudo nano /etc/ssh/sshd_config
Find and change:
PasswordAuthentication no
Save and restart SSH:
sudo systemctl restart sshd
Enable Firewall
ssh claudeteam@YOUR_SERVER_IP
# Allow SSH
sudo ufw allow 22/tcp
# Enable firewall
sudo ufw enable
# Check status
sudo ufw status
Keep System Updated
Run monthly:
ssh claudeteam@YOUR_SERVER_IP
sudo apt update && sudo apt upgrade -y
Quick Reference Card
Print this and keep handy:
═══════════════════════════════════════
CLAUDE CODE COLLABORATION
═══════════════════════════════════════
Server IP: ________________
Username: claudeteam
Session: claude-collab
═══════════════════════════════════════
COMMANDS
═══════════════════════════════════════
Join session:
ssh claudeteam@SERVER_IP
join-claude-session.sh YOUR_NAME claude-collab
Check if running:
ssh claudeteam@SERVER_IP
tmux ls
Restart session:
ssh claudeteam@SERVER_IP
tmux kill-session -t claude-collab
tmux new-session -s claude-collab -d
tmux send-keys -t claude-collab "claude-code" C-m
Exit session:
Ctrl+B, then D
═══════════════════════════════════════
Next Steps
- Part 1: Create SSH key ✓
- Part 2: Create DigitalOcean droplet ✓
- Part 3: Connect to server ✓
- Part 4: Set up server ✓
- Part 5: Install collaboration script ✓
- Part 6: Set up local Mac ✓
- Part 7: Join session ✓
- Part 8: Add collaborator ✓
- Part 9: Start collaborating! ✓
Support
- DigitalOcean Documentation: https://docs.digitalocean.com/
- DigitalOcean Community: https://www.digitalocean.com/community
- Repository Issues: https://github.com/jxandery/claude-code-collab/issues
- tmux Guide: https://tmuxcheatsheet.com/
Ready to start? Begin with Part 1 and you'll be collaborating in about an hour!