DEV Community

Cover image for Stop running `claude login` on every machine — share your Claude Code accounts between your devices
Bargan Constantin
Bargan Constantin

Posted on

Stop running `claude login` on every machine — share your Claude Code accounts between your devices

I build ccdeck, the open-source tool this post uses. The step-by-step guides behind it are on ccdeck.dev.

I work on two machines, sometimes three. A laptop I carry around, a desktop at home, and a Windows box I test on. Claude Code runs on all of them, and on most days I switch between a work account and a personal one.

That setup has one boring, recurring problem: a Claude login expires on the machine that has not used it for a while, and stays alive on the one that has. With two or three machines that is a claude login about once a week, and it always happens on the machine I am not sitting at. I sit down, start an agent, and the first thing it does is ask me to sign in again.

This post shows how I fixed it with ccdeck, in three steps:

  1. Keep several Claude accounts on one machine, and see how much quota each has left.
  2. Move those accounts to another machine once, with a single paste.
  3. Pair the machines so that an expired login is copied back from a machine that still has it, without me doing anything.

One thing to be clear about first: this is for your own accounts on your own machines. It is not a way to share a subscription with other people.


What ccdeck is, in one paragraph

ccdeck is a local dashboard for Claude Code and Codex CLI. You run npx ccdeck (or install the desktop app), and it opens on http://127.0.0.1:4317 with every session on the machine drawn live: which session is waiting on you, every subagent and tool call, cost and quota. The part this post is about is its Claude accounts panel, which sits on top of claude-swap, a small tool that stores more than one Claude login and switches between them. ccdeck installs claude-swap for you the first time it finds Claude Code.

npx ccdeck
Enter fullscreen mode Exit fullscreen mode

If you want the full install walkthrough first, it is in the first-run guide.


Step 1 — Several Claude accounts on one machine

Press A (or click the Claude accounts icon at the top of the stripe on the left) to open the Claude accounts panel. Click +, then Open the sign-in page, and approve the sign-in in the browser tab that opens, as the account you want to add.

The account you were using stays active. Signing in normally replaces the live credentials, so the deck switches the previous one back as soon as the new one is recorded.

Each account then gets a row with its 5-hour and 7-day usage:

The Other accounts list: two accounts with their 5-hour and 7-day usage, a Switch button on each, and Auto-switch underneath
Demo data. Figures turn amber at 70% and red at 90%.

A few things I use every day:

  • Switch on a row makes that account active. New sessions start on it; sessions already running pick it up on their next message.
  • The gauge in the panel header opens Account capacity: how many accounts are ready, and what the 5-hour and 7-day windows have left across all of them.
  • Auto-switch (off until you turn it on) runs claude-swap's own engine every 60 seconds and moves you to another account when the active one passes a threshold you pick — 70, 80, 85, 90 or 95%, or a custom whole percentage from 50 to 99. Every account keeps its own limits; if no eligible account has room, nothing switches.

Account capacity: 3 of 3 accounts ready, with the remaining 5-hour and 7-day share across all of them
Demo data.

On a Mac: the login lives in the Keychain. Start ccdeck from a Terminal window or at login, not over SSH, or claude-swap cannot read it and every row says "Keychain unreadable".

Full guide: Switch between multiple Claude Code accounts.


Step 2 — Move your accounts to another machine, once

On a new machine you could sign in to every account again. Or you can carry them over in one paste.

On the machine that has the accounts, open the accounts panel and click ↗ in its header. Every account starts ticked; untick the ones that should stay. Click Share N accounts, then copy all N.

The Share accounts dialog: 3 accounts ready to paste, one line of text starting with ccdeck2:, and a warning that this is 3 passwords that expire in 10 minutes
Demo data. The text shown is not a real share.

On the second machine: accounts panel → + → Paste a share → paste → Import. Each account gets a result line:

  • imported — this machine did not have it, and now does;
  • already here — left exactly as it was (there is an update anyway button if you need it);
  • dead token replaced — claude-swap had marked the login it held as dead, and the share healed it.

The import result: 1 of 3 imported, 1 had a dead token replaced, 1 already here
Demo data.

The share carries logins only: no projects, sessions, MCP servers or deck settings. Making it changes nothing on the first machine; both machines now have the accounts.

Treat that text as passwords — because it is

This is the part I want every reader to take seriously:

  • The share is not encrypted. It is claude-swap's export, compressed and base64-encoded. Anyone who has it can use those accounts.
  • The deck refuses to import it after ten minutes, but nothing cryptographically enforces that; the tokens inside stay valid after that. A copy can linger in a clipboard history, or sync to your other devices.
  • Carry it by a route you would trust with the passwords themselves. If a copy ends up somewhere it should not, sign those accounts out and back in at Anthropic — that is what revokes a login.

Full guide: Copy your Claude Code login to another machine.


Step 3 — Let your machines repair each other's logins

Step 2 is a one-off. Step 3 is what actually ended my weekly claude login.

At the bottom of the accounts panel there is a Local network row. With it on, decks on the same network find each other, pair, and a login that has expired on one machine is copied from another machine that still has a working copy, about once a minute.

The Local network view: Sync with paired decks is on, no deck paired yet
Demo data.

What it sends

While the switch is on, the deck announces its name, a key fingerprint and its port every 30 seconds on UDP port 45317, where every machine on the network can hear it. It also listens for other decks on a TCP port of its own. That is worth knowing before you turn it on at a coffee shop — more on that below.

Tick what each machine may hand out

Click the sliders button at the top of the Local network view. Under Share these accounts, tick each login this machine may give to a paired machine.

The
Demo data. Only one of the two accounts is ticked.

Tick each login on the machine that may hand it out. A paired deck can add an account it is missing or repair an expired copy from those shared logins. An account you leave unticked is not offered by this machine.

Pair

As shipped, decks on one network pair on their own within a minute or two. If you turn off Say yes to every deck that asks, a "A deck wants to pair" dialog appears instead — click Accept only if the fingerprint matches the one the other machine shows under its own name. (Decline has the focus, so a stray Enter shares nothing.)

Watch an expired login come back

When a login is rejected on this machine, its row says Login expired. If a paired machine has a working copy and ticks it, the next round copies it over. Click the other deck's row to see what the next round will do:

A paired deck's dialog: one account expired here and working on the other machine, marked
Demo data.

Two rules make this safe to leave running:

  • A working login is never replaced. A paired machine can add a missing account or repair a copy that has expired here.
  • If every machine's copy has expired, the row says Login expired on all online decks. Sign in again on any one of them, and the next round brings it to the others.

When they cannot see each other

Two subnets, a guest network, a VPN: the UDP announcement does not cross them. Click the chain-link button to open Add a deck, then either type the other deck's address, or make an invite on one machine and paste it on the other. An invite works once and lasts ten minutes; whoever pastes it dials out, so paste it on the machine that cannot be reached from outside.

The Add a deck dialog: pair by address, or with an invite
Demo data.

If you use Tailscale, the This deck on the network dialog has a Look for my devices switch that finds decks on your other machines over your tailnet, wherever they are — only machines signed in to your own Tailscale account are asked or answered without a click.

Full guide: Repair expired Claude Code logins across machines.


The security model, in plain words

Pairing is the decision that matters, so here is what it means:

  • A paired deck can copy any login you tick, and what crosses the wire is the live credential, sealed to the deck it is addressed to.
  • On a network you do not own, turn off Say yes to every deck that asks, or turn on Pair new decks only by invite. If you never want it, start the deck with AGENTS_DECK_NO_LAN=1 and Local network stays off whatever the switch says.
  • Unpairing and unticking take nothing back. They stop future rounds; a login already copied stays where it went. Only signing in again at Anthropic revokes a login everywhere.
  • If you remove an account on one machine while a paired machine still ticks it, it can come back on the next round. Untick it on the other machine first.

Wrap-up

What I do now, on every new machine:

  1. npx ccdeck (or install the app).
  2. Paste one share from a machine I already use — every account arrives at once.
  3. Tick the accounts under Local network, on both sides.

After that I stopped thinking about logins. When one expires on the machine I have not touched for a week, it is quietly repaired from the one I used yesterday.

If you try it and something does not work as described, an issue is the fastest way to get it fixed.

Top comments (0)