Remote Access to Odin via Tailscale

networking · tailscale · remote-access|2025-11-11 · 5 min read

Research and configuration guides for accessing Odin (home Mac) remotely while traveling.

Prerequisites

  • ✅ TailScale VPN configured on both Odin and laptop
  • ✅ Syncthing running for file synchronization
  • ✅ Same iCloud account syncing Documents folder

Remote Desktop Access

Advantages:

  • Native macOS integration
  • Works over TailScale VPN
  • Low bandwidth usage
  • Secure encryption

Setup on Odin:

  1. Enable Screen Sharing:

    # Via System Settings UI
    System Settings General Sharing Screen Sharing (enable)

    Or via command line:

    sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
  2. Configure Access:

    • Allow access for: "Only these users" → Add your user account
    • Or allow "All users" if multiple accounts need access
  3. Get TailScale IP:

    tailscale ip -4
    # Example output: 100.x.x.x

Connect from Laptop:

  1. Via Finder:

    • Press ⌘K (Connect to Server)
    • Enter: vnc://100.x.x.x (Odin's TailScale IP)
    • Click Connect
    • Enter macOS credentials
  2. Via Screen Sharing App:

    open vnc://100.x.x.x
  3. Create Bookmark:

    • After connecting, add server to sidebar for quick access
    • Or create alias: ssh odin 'open vnc://localhost' (if SSH configured)

Option 2: Apple Remote Desktop (ARD)

More features but requires app purchase. Screen Sharing is sufficient for most needs.

Option 3: Third-Party Solutions

NoMachine, AnyDesk, TeamViewer:

  • Generally unnecessary when TailScale + Screen Sharing works
  • May have additional latency or costs
  • Consider only if Screen Sharing performance is inadequate

Performance Optimization

Network Settings:

  • TailScale direct connection is ideal (peer-to-peer when possible)
  • Check connection quality: tailscale status
  • If relayed connection, consider: tailscale up --accept-routes

Screen Sharing Quality:

  • Adaptive quality based on bandwidth
  • Lower resolution/color depth for slow connections
  • Full quality when on same network or good connection

Security Notes

  • TailScale provides WireGuard encryption
  • Screen Sharing adds VNC encryption layer
  • Ensure Odin firewall allows TailScale connections
  • Consider requiring password after sleep/screensaver

SSH Access + tmux

SSH Configuration

Setup on Odin:

  1. Enable Remote Login:

    # Via System Settings UI
    System Settings General Sharing Remote Login (enable)

    Or via command line:

    sudo systemsetup -setremotelogin on
  2. Verify SSH is running:

    sudo launchctl list | grep ssh
    # Should see: com.openssh.sshd
  3. Get TailScale IP (if not already noted):

    tailscale ip -4
    # Example: 100.x.x.x

Configure on Laptop:

  1. Create SSH config for easy access:

    # Edit ~/.ssh/config
    cat >> ~/.ssh/config <<EOF
     
    Host odin
        HostName 100.x.x.x
        User $(whoami)
        ForwardAgent yes
        ServerAliveInterval 60
        ServerAliveCountMax 3
    EOF
  2. Set up SSH key authentication (if not already done):

    # Generate key if needed
    ssh-keygen -t ed25519 -C "laptop-to-odin"
     
    # Copy to Odin
    ssh-copy-id odin
  3. Test connection:

    ssh odin

tmux Session Management

Philosophy:

  • Use named tmux windows to identify processes
  • Never kill the 'agent' window (where Claude Code runs)
  • Always verify window names before operations

Common Workflows:

  1. Connect to existing tmux session:

    ssh odin
    tmux attach
  2. List tmux windows remotely:

    ssh odin "tmux list-windows"
  3. View specific window output:

    ssh odin "tmux capture-pane -t <window-name> -p | tail -20"
  4. Create new background window:

    ssh odin "tmux new-window -n <name> -d '<command>'"
  5. Kill specific window (NEVER 'agent'):

    # First verify windows
    ssh odin "tmux list-windows"
     
    # Then kill by name
    ssh odin "tmux kill-window -t <window-name>"

Helper Functions (add to laptop's ~/.zshrc or ~/.bashrc):

# Quick tmux window listing on Odin
alias odin-tmux='ssh odin "tmux list-windows"'
 
# View window output
odin-tmux-view() {
    ssh odin "tmux capture-pane -t $1 -p | tail -20"
}
 
# Safe window kill (with confirmation)
odin-tmux-kill() {
    local window=$1
    if [[ "$window" == "agent" ]]; then
        echo "ERROR: Cannot kill 'agent' window (Claude Code)"
        return 1
    fi
    echo "Killing window: $window"
    ssh odin "tmux kill-window -t $window"
}

Safety Checks:

# Always rename Claude Code window first (on Odin)
tmux rename-window agent
 
# Before any operations, list windows
tmux list-windows
 
# Verify agent window exists
tmux list-windows | grep agent

SSH + tmux Best Practices

  1. Persistent Sessions:

    • tmux sessions survive SSH disconnections
    • Reattach anytime with ssh odin then tmux attach
  2. Network Resilience:

    • Use mosh instead of SSH for unstable connections:

      brew install mosh
      ssh odin "brew install mosh"
      mosh odin
  3. Session Naming:

    • Use descriptive tmux session names:

      tmux new-session -s work
      tmux new-session -s automation
  4. Monitoring:

    • Check TailScale status: ssh odin "tailscale status"
    • Monitor tmux sessions: ssh odin "tmux ls"

Troubleshooting

Cannot Connect to Screen Sharing

  1. Check TailScale:

    tailscale status
    # On both laptop and Odin
  2. Verify Screen Sharing is enabled:

    ssh odin "sudo launchctl list | grep screensharing"
  3. Check firewall:

    ssh odin "sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate"
  4. Test VNC port:

    nc -zv 100.x.x.x 5900

SSH Connection Issues

  1. Verify Remote Login:

    ssh odin "sudo systemsetup -getremotelogin"
    # Should return: Remote Login: On
  2. Check SSH daemon:

    ssh odin "sudo launchctl list | grep ssh"
  3. Test basic connectivity:

    ping 100.x.x.x
    tailscale ping odin

tmux Session Not Found

  1. List all sessions:

    ssh odin "tmux ls"
  2. Create new session if needed:

    ssh odin "tmux new-session -d -s main"
  3. Attach to specific session:

    ssh odin "tmux attach -t main"

Quick Reference

Connect to Odin:

# Screen Sharing
open vnc://100.x.x.x
 
# SSH
ssh odin
 
# SSH + tmux attach
ssh odin -t "tmux attach"

Monitor Running Processes:

# View tmux windows
ssh odin "tmux list-windows"
 
# View specific window
ssh odin "tmux capture-pane -t <window-name> -p | tail -20"
 
# View all tmux sessions
ssh odin "tmux ls"

TailScale Management:

# Check status
tailscale status
 
# Get IP
tailscale ip -4
 
# Ping peer
tailscale ping odin

Next Steps

  • Enable Screen Sharing on Odin
  • Enable Remote Login (SSH) on Odin
  • Configure SSH config on laptop with 'odin' alias
  • Test Screen Sharing connection
  • Test SSH + tmux access
  • Add helper functions to laptop shell config
  • Bookmark Odin's VNC address in Finder
  • Verify TailScale connection quality
  • RESOURCES/research--workflow-cron-automation.md - Scheduling workflows while away
  • .agents/scripts/README.md - Workflow dispatcher documentation