Skip to content

Complete Guide to Using Claude Code Remotely

Remote Access Security Mobile

What You Can Achieve

  • 🚀 Remote Development Continuity

    Seamlessly access your home development environment from anywhere

  • 🔒 Secure Remote Access

    Encrypted, safe connections via Tailscale + SSH

  • 📱 Mobile Optimization

    Efficient remote development with minimal data usage

  • Persistent Sessions

    Interrupt and resume development sessions with tmux

📖 Overview

Claude Code is a powerful AI development tool, but using it remotely requires careful planning. This guide covers how to efficiently use Claude Code while traveling, balancing security and data efficiency.

Tailscale + SSH Configuration

The most secure and stable approach, providing end-to-end encryption without VPN complexity.

Prerequisites

# Start SSH server on home PC (WSL2 environment)
sudo service ssh start

# Install Tailscale
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up

Remote Connection Steps

  1. Connect via Termius App

    ssh username@tailscale-ip-address
    

  2. Resume tmux Session

    tmux attach-session -t claude-session
    

  3. Launch Claude Code

    claude
    

Pros and Cons

✅ Advantages - Use existing development environment as-is - Highest security level - Minimal data usage - Low setup cost

❌ Disadvantages - Requires home PC power management - Dependent on connection quality - Static IP recommended

Security Configuration

# Set up SSH key authentication
ssh-keygen -t ed25519 -C "mobile-access"
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@tailscale-ip

# Disable password authentication
sudo sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
sudo service ssh restart

☁️ Method 2: GitHub Codespaces

Cloud Development Environment

Cloud-based development using GitHub Codespaces infrastructure.

Setup Process

  1. Repository Preparation

    # Create .devcontainer/devcontainer.json
    {
      "name": "Claude Code Environment",
      "image": "mcr.microsoft.com/vscode/devcontainers/python:3.11",
      "features": {
        "ghcr.io/devcontainers/features/node:1": {},
        "ghcr.io/devcontainers/features/git:1": {}
      },
      "postCreateCommand": "npm install -g @anthropic-ai/claude-code"
    }
    

  2. Launch Codespace

  3. Access repository on GitHub
  4. "Code" → "Codespaces" → "Create codespace"

  5. Initialize Claude Code

    claude auth login
    claude init
    

Pricing Structure

PlanHourly RateMonthly Free Tier
2 core$0.18/hour120 hours
4 core$0.36/hour60 hours
8 core$0.72/hour30 hours

Pros and Cons

✅ Advantages - No infrastructure management - Consistent environment anywhere - Scalable resources - Automatic backups

❌ Disadvantages - Usage-based billing - Network latency - Customization limitations

📊 Data Efficiency Strategies

Claude Code Usage Monitoring

# Install Claude Code Usage Monitor
npm install -g claude-code-usage-monitor
claude-monitor start

Token Optimization Tips

  1. Session Management
  2. Understand 5-hour rolling windows
  3. Use parallel sessions for efficiency

  4. Command Optimization

    # Efficient query example
    claude "Continue from previous work, please add tests"
    
    # Inefficient example (avoid)
    claude "Review entire file and translate all comments to Japanese"
    

  5. CLAUDE.md Utilization

    # Project-specific settings
    ## Coding Standards
    - Indentation: 2 spaces
    - Comments: English
    - Testing: Jest framework
    

Data Usage Estimates

ActivityData per Hour
SSH + Claude Code5-10MB
Codespaces50-100MB
VS Code Spaces30-80MB

🔒 Security Considerations

Security Levels by Method

MethodSecuritySetup DifficultyRecommendation
Tailscale + SSH⭐⭐⭐⭐⭐⭐⭐🥇
GitHub Codespaces⭐⭐⭐⭐🥈
VS Code Spaces⭐⭐⭐🥉

Security Best Practices

  1. Authentication Hardening

    # Enable 2FA
    gh auth login --with-token < token.txt
    

  2. Access Restrictions

    # IP restrictions (when using Tailscale)
    sudo ufw allow from 100.64.0.0/10 to any port 22
    

  3. Log Monitoring

    # Check SSH connection logs
    sudo tail -f /var/log/auth.log
    

💰 Cost Comparison

Monthly Usage Cost Estimates

Assumptions: 2 hours weekdays, 3 hours weekends remote work

MethodMonthly CostBreakdown
SSH Connection$20Claude Pro: $20 (total)
Codespaces$90Claude Pro + Codespaces usage
VS Code Spaces$70Claude Pro + VS Code usage

Cost-Performance Analysis

  1. SSH Connection: Best value, for technical users
  2. Codespaces: Moderate value, for team development
  3. VS Code Spaces: Balanced option, for individual development

🛠️ Complete Setup Guide

Full SSH Connection Setup

# Step 1: Prepare home environment
sudo apt update && sudo apt install openssh-server tmux
sudo systemctl enable ssh

# Step 2: Tailscale setup
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up --advertise-routes=192.168.1.0/24

# Step 3: tmux configuration
cat > ~/.tmux.conf << EOF
set -g mouse on
set -g default-terminal "screen-256color"
bind r source-file ~/.tmux.conf
EOF

# Step 4: Create Claude Code session
tmux new-session -d -s claude-session
tmux send-keys -t claude-session 'claude' C-m

Troubleshooting

Connection Issues

# Check Tailscale status
tailscale status
tailscale ping target-machine

# Verify SSH configuration
sudo systemctl status ssh
sudo tail /var/log/auth.log

Performance Degradation

# Check bandwidth
iperf3 -s  # Server side
iperf3 -c server-ip  # Client side

# Monitor Claude Code usage
claude-monitor stats

📱 Mobile Optimization Tips

  1. Termius: Premium SSH client
  2. Multi-tab support
  3. Key management
  4. Port forwarding

  5. Working Copy: Git client

  6. SSH key management
  7. Local editing capabilities
  8. Shortcuts integration

  9. Shortcuts: Automation

    SSH Connect → tmux Resume → Claude Launch
    

Battery Optimization

# Limit CPU usage
nice -n 19 claude
cpulimit -l 50 -p $(pgrep claude)

# Power saving mode
echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor