Run Claude Code on a VPS and access it from your phone, tablet, or any device with a terminal app. Code from anywhere.
- A VPS (Hostinger, Hetzner, DigitalOcean, etc.) - $5/mo tier is plenty
- 4GB RAM minimum, 8GB+ recommended
- A mobile SSH client (Termius recommended)
If using Hostinger, select the "Claude Code" app template during setup - it comes pre-installed.
For manual installation on any VPS:
# SSH into your VPS
ssh root@your-vps-ip
# Install Node.js and npm
apt update && apt install -y nodejs npm
# Install Claude Code globally
npm install -g @anthropic-ai/claude-code
# Start Claude Code
claudeBefore accessing from mobile, lock down your server:
# Disable password authentication (SSH keys only)
sudo sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication no/' \
/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf && \
sudo systemctl restart ssh
# Install fail2ban to block brute force attacks
sudo apt install fail2ban -y
# Enable firewall - only allow SSH
sudo ufw allow 22 && sudo ufw enable- Download Termius on your phone (iOS/Android) - it's free
- Add a new host with your VPS IP address
- Connect using your SSH key or password
Keep your Claude Code session alive even when your phone disconnects:
# Install tmux
sudo apt install tmux -y
# Start a new named session
tmux new -s claude
# Run Claude Code inside the session
claudeEnable mouse scrolling (so you can scroll with your finger):
echo "set -g mouse on" >> ~/.tmux.conf && tmux source-file ~/.tmux.confReconnect to your session after disconnect:
tmux attach -t claude| Command | What it does |
|---|---|
tmux new -s claude |
Start a new tmux session named "claude" |
tmux attach -t claude |
Reconnect to your session |
tmux ls |
List all sessions |
Ctrl+B, D |
Detach from session (leave it running) |
If Claude Code can't complete OAuth login:
# Option 1: SSH port forwarding (run from your local machine)
ssh -L 15735:localhost:15735 user@your-vps-ip
# Option 2: Use API key directly
export ANTHROPIC_API_KEY=your-key-here
claudeMake sure mouse mode is enabled:
echo "set -g mouse on" >> ~/.tmux.conf
tmux source-file ~/.tmux.confThis is why we use tmux! Your session keeps running. Just reconnect with:
tmux attach -t claudeClaude Code can use significant memory. Monitor with htop and restart Claude periodically if needed.
| Provider | Price | Notes |
|---|---|---|
| Hostinger | ~$5/mo | Has Claude Code pre-installed template |
| Hetzner | ~$5/mo | Great value, Europe-focused |
| Vultr | ~$12/mo | Fast performance |
| DigitalOcean | ~$6/mo | Developer-friendly |
- Claude Code Documentation
- Termius - Mobile SSH client
- tmux Cheat Sheet
MIT - Do whatever you want with this.