🧠 Close the laptop, keep the session — Claude Code lives in one LXC

One box runs your AI coder. Your laptop is just a window into it.

digraph g { rankdir=TB; bgcolor="transparent"; nodesep=0.8; ranksep=0.6; node [shape=box style="rounded,filled" fillcolor="#ffffff" color="#0b1622" penwidth=2 margin="0.35,0.2" fontname="sans-serif" fontsize=14 fontcolor="#0b1622"]; edge [color="#2f7d52" penwidth=2 fontname="sans-serif" fontsize=12 fontcolor="#0b1622"]; laptop [label="💤 laptop - lid closed"]; host [label="🖥️ Proxmox VE host"]; lxc [label="📦 Debian 13 LXC"]; sess [label="♻️ tmux: forge"]; code [label="🧠 Claude Code"]; client [label="📱 any device"]; laptop -> host [label="ssh"]; host -> lxc; lxc -> sess; sess -> code; {rank=same; sess; client;} client -> sess [style=dashed, label="attach", constraint=false]; }
  • :zzz: close the lid mid-thought → :recycling_symbol: the session keeps running
  • :desktop_computer::mobile_phone: desktop, laptop, phone on ssh → one live session
  • :prohibited: no Docker, no cloud account, no port-forwarding
  • :electric_plug: your move → Proxmox Console, one pasted line, two minutes

:white_check_mark: 8 checks passed · :hourglass_not_done: 2 honest gaps - both lists inside the drawer

the whole build - 6 stages, every command, the trap that ate my first launch, and what I have not verified

:package: ① prep the container (example id 260)

pct exec 260 -- apt-get update
pct exec 260 -- apt-get install -y tmux curl git ca-certificates

→ Node.js, Claude Code and the FCC wrapper need their own installers · the /opt/fcc-… path below is mine, not a default

:bust_in_silhouette: ② its own user, and proof Claude Code runs

pct exec 260 -- useradd -m -s /bin/bash claude        # skip if it exists
pct exec 260 -- /usr/local/bin/claude --version

→ this user owns the project, never root · a printed version = pass, a missing binary or permission error = fail · then log Claude Code in

:recycling_symbol: ③ the session that survives disconnects — tmux

pct exec 260 -- runuser -u claude -- tmux new-session -d -s forge -c /var/www/claude-site /bin/bash
pct exec 260 -- runuser -u claude -- tmux list-sessions     # → forge: 1 windows
ssh -tt root@YOUR-PROXMOX-HOST 'pct exec 260 -- runuser -u claude -- tmux attach-session -t forge'
printf 'TMUX=%s\n' "${TMUX:-NOT_ATTACHED}"                  # → a session id, or NOT_ATTACHED = you are outside tmux

→ leave it alive: Ctrl+B then D · never /exit inside Claude Code · re-check list-sessions after disconnecting · it beats a disconnect, not a reboot

:warning: ④ the PATH trap, and the wrapper

export PATH="/usr/local/bin:/opt/fcc-6.16.2/bin:$PATH"
/opt/fcc-6.16.2/bin/fcc-claude

→ first try: Could not find Claude Code command: claude

printf 'PATH=%s\n' "$PATH"     →  PATH=/sbin:/bin:/usr/sbin:/usr/bin
ls -l /usr/local/bin/claude    →  /usr/local/bin/claude -> /usr/local/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe

→ nothing was missing · /usr/local/bin was not on PATH · add it, retry, it opens · real output: Claude Code v2.1.296 · Opus 5.5 · API Usage Billing · /var/www/claude-site · check PATH before reinstalling anything

:desktop_computer: ⑤ no workstation needed

pct enter 260
su - claude
tmux attach-session -t forge

→ or a second Claude Code in another project directory · never edit one project from two sessions without a Git worktree or another isolation scheme

:brick: how the pieces sit (his sketch, from the original)

Linux workstation
       |
       | SSH
       |
Proxmox VE host
       |
       +--- Debian 13 LXC
                 |
                 +--- Dedicated Linux user
                 |
                 +--- Project directory
                 |
                 +--- Claude Code
                 |
                 +--- FCC wrapper
                 |
                 +--- tmux
                        |
                        +--- Persistent session

→ his own one-line goal: disconnect the client without intentionally terminating the interactive AI coding session

:white_check_mark: verified · Proxmox→LXC exec · SSH from a Linux workstation · tmux installed · dedicated account · claude --version · FCC wrapper launch · interactive Claude Code in tmux · project dir reachable

:hourglass_not_done: not yet · reconnect after client shutdown · LXC reboot recovery · Proxmox reboot recovery · all MCP integrations and auth paths

:brain: ⑥ what this taught me
→ a clean install is not proof of a working environment
→ a running background process is not proof the session is still reachable
→ a missing command is not missing software
→ tmux is not a backup - keep the project files backed up, credentials private
→ install once · connect from authorized clients · detach safely · verify the running session

8 Likes

This, my friend, is one of those things that people need but never create. This is gonna be a LIFESAVER.

2 Likes

Love this setup. I used to babysit long runs on my laptop and one dead battery cost me an entire afternoon of work, so the “close the lid and walk away” part speaks to me.

Two things I’d add from my own experience: set up proper session logging inside tmux so you can see exactly where things stopped if the container ever reboots, and give the LXC a fixed hostname or IP so you’re not hunting for it from your phone at midnight. Small things, but they save you the one time it actually matters.

The phone-over-ssh bit is the real win though. Reviewing diffs from the couch is dangerously comfortable.

3 Likes

Tks, on laptop or pc can do as Tips we’re created on VietTube AI channel

Really like the simplicity of this — one LXC plus tmux beats juggling Docker or a cloud VM for this kind of thing. I lost a long refactoring session to a sleeping laptop once, so the always-on box idea hits home. One question though: how does the Claude Code auth behave when the tmux session stays detached for days? Does the token refresh hold up fine, or do you have to re-auth after a while?

1 Likes