brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Claude Code on your own VM: MacBook for the conversation, Unraid for the work

Claude Code on your own VM: MacBook for the conversation, Unraid for the work

Guide unraid

11 steps 8 min read

A coding assistant that works on a task for an hour doesn’t belong on a laptop that goes into a bag. I’d put it on a VM on the Unraid box and use the MacBook as the keyboard. What you get: a small Ubuntu VM that runs Claude Code inside tmux, reachable over Tailscale from wherever you are, and a session that keeps going when the lid closes. What you need: an Unraid server with hardware virtualization switched on in the BIOS, an Ubuntu Server ISO, a Claude Pro, Max, Ultra, Team, Enterprise or Console account, and a free Tailscale account. The Claude Code docs list Ubuntu 20.04+ and 4 GB of RAM or more, so I’d size the VM to that.

Time
8 min
Steps
11
Updated
19 Nov 2026

You will learn

  • The idea in one picture
  • Check that VMs can run at all
  • Create the Ubuntu VM
  • SSH with a key of its own
  • Tailscale on the VM

Step 1 of 11: The idea in one picture

A laptop closes, changes Wi-Fi and falls asleep. A VM on your NAS does none of that. Several write-ups of running Claude Code remotely land on the same recipe: a server or VM, SSH, tmux and Tailscale. Harper Reed does it from his phone and Jack Tan towards a Mac. The steps below are that recipe on Unraid, with the Unraid-specific parts checked against the Unraid docs.

Diagram: a MacBook connects over a Tailscale tunnel to a dev-vm Ubuntu VM on an Unraid server, running Claude Code inside a tmux session

Step 2 of 11: Check that VMs can run at all

Unraid VMs need Intel VT-x or AMD-V enabled in the BIOS (the label differs per board, look for “Virtualization”). The Unraid docs also expect the isos and domains shares to exist: the first holds install media, the second holds the virtual disks. Then open Settings > VM Manager in the web GUI. A Virtual Machines tab shows up once the manager is enabled; the exact toggle may look different per Unraid version, so check yours.

Network: the docs say to enable bridging under network settings and pick a default bridge. br0 gives the VM its own address on your LAN, virbr0 is a private NAT network. If the server is on Wi-Fi, use virbr0. Because the VM will only need to reach the internet and, later, my tailnet, I’d take whichever your setup already uses.

Then copy the Ubuntu Server ISO into the isos share.

Step 3 of 11: Create the Ubuntu VM

On the Virtual Machines page click Add VM. Choose a template (Custom, or an Ubuntu or Linux one if your version lists it) and fill in:

Name:             dev-vm
CPU cores:        4
Initial memory:   8 GB
OS Install ISO:   the Ubuntu Server ISO from the isos share
Primary vDisk:    60 GB
Graphics card:    VNC

Those numbers are my starting point. The docs only say not to give more cores than the host has and to follow your distribution’s memory advice. In the advanced view the docs call Q35 the default machine type and OVMF (UEFI) the recommended BIOS for modern Linux. The BIOS type can only be set when you create the VM, so look at it before you click Create VM. For the vDisk, RAW is the fast one and QCOW2 is the one you need for snapshots. A VM that holds code you can re-clone, I’d keep RAW.

Start it, open the VNC console from the VM’s menu and click through the Ubuntu Server installer. Tick Install OpenSSH server when it asks. That is the last time you need VNC. Set Autostart on the VM if it should come up with the array.

Step 4 of 11: SSH with a key of its own

On your MacBook, make a separate key for this VM and put only the public half on it. Use the VM’s address from your router for now; the tailnet name comes in the next step.

ssh-keygen -t ed25519 -f ~/.ssh/dev-vm -C "macbook-dev-vm"
ssh-copy-id -i ~/.ssh/dev-vm.pub @
ssh -i ~/.ssh/dev-vm @

If the last line logs you in without a password, switch password logins off in /etc/ssh/sshd_config (PasswordAuthentication no) and restart ssh. Do that only after the key login works, or you lock yourself out of a VM that you can only reach by VNC.

Step 5 of 11: Tailscale on the VM

Install it inside the VM, not on the Unraid host, so the VM gets its own tailnet identity:

curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
tailscale ip

tailscale up prints a URL. Open it on any device that has a browser and sign in, then the VM shows up on the Machines page of the admin console. From now on ssh -i ~/.ssh/dev-vm <user>@dev-vm works from anywhere on the tailnet and port 22 never faces the internet. Give the VM a tag and a tight policy as in my ACL guide, because the VM is the one machine that runs commands on its own. A key that expires is another way to find out the hard way, so read the key expiry guide too.

Optional: sudo tailscale set --ssh turns on Tailscale SSH, which needs an ssh rule in the policy file and replaces key management with tailnet identity. I keep plain SSH keys here, since they keep working when Tailscale is down.

Animated terminal showing ssh to a VM, starting a tmux session, losing the connection and reattaching to the same session

Step 6 of 11: Tmux, and mosh if you like

tmux is the core. Install it, start a named session and let the agent run inside it:

sudo apt install tmux
tmux new -A -s claude

-A means attach if the session exists, create it if not, so the same line works every time. Detach with Ctrl+b then d; the programs keep running. tmux ls lists what is alive.

mosh is the extra for a laptop that hops between networks. It logs in over SSH, then continues over UDP in the 60000-61000 range, and it must be installed on both ends (sudo apt install mosh on Ubuntu). It only syncs the visible screen, so its own docs suggest tmux for scrollback. If your tailnet policy is tight, allow that UDP range to the VM. That last part is my reading, not something I checked.

mosh @dev-vm -- tmux new -A -s claude

Step 7 of 11: Install Claude Code and log in

Inside the VM, in the tmux session:

curl -fsSL https://claude.ai/install.sh | bash
claude --version
claude doctor

That is the native installer the docs recommend; it updates itself in the background. If claude is not found, open a new shell, the install directory may not be on your PATH yet. claude doctor prints a read-only health check. If you’d rather have apt updates, the docs also have a signed apt repository.

Run claude and log in. A VM has no browser, so the docs’ trick for SSH sessions is the one to use: press c to copy the login URL, open it in the browser on your MacBook, sign in, and paste the code the page shows at the Paste code here prompt. If pasting does nothing, claude auth login reads the code from standard input. On Linux the login lands in ~/.claude/.credentials.json with mode 0600, so treat the VM as a place that holds your login.

Step 8 of 11: Keep the session alive

With tmux, closing the laptop changes nothing: the agent keeps working and you re-attach later with the same command. The docs say it themselves about Remote Control: if you run claude on a remote machine, start it inside tmux or screen so it survives an SSH drop. Remote Control lets you steer the same session from claude.ai/code or the Claude app:

claude remote-control

It needs a claude.ai login, so a token from claude setup-token won’t do, and the process has to stay running, hence tmux. If the login expires the session disconnects until you run /login again; /status shows an expired login before a request fails.

Step 9 of 11: What runs where, my advice

My split: short questions and quick edits in a file I have open anyway stay local on the MacBook. Long tasks, anything that runs for hours, and tests of Linux behaviour go on the VM.

Keep the VM small and boring. Code arrives by git clone, not by mounting your NAS shares into it, and I’d put only the keys that a task needs on it. I like a VM I can delete and rebuild in an evening. Unraid’s own backup of the vdisk file is plenty for the rest.

Step 10 of 11: Troubleshooting

Permission denied (publickey). The wrong key is offered. Pass -i ~/.ssh/dev-vm or add a Host dev-vm block with IdentityFile to ~/.ssh/config.

The VM does not show on the tailnet. Run tailscale status in the VM; if it asks to log in, rerun sudo tailscale up.

mosh hangs on connecting. The server needs mosh installed and UDP 60000-61000 open on the path.

claude: command not found. New shell first, then see the PATH section of the Claude Code troubleshooting page.

Login fails with a localhost error. Use the separate login URL and paste the code, as in step 6.

The session is gone after a reboot. tmux survives a dropped connection but not a restart of the VM, and Autostart does not bring your session back.

Step 11 of 11: Where to go next

Lock the VM down with Tailscale ACLs and tags, and keep an eye on key expiry so the VM does not drop off your tailnet.

Further reading

Link