Show HN: Claude-account – switch Claude Code accounts without logging in again

Hacker News Top Tools

Summary

claude-account is a Linux tool that allows users to switch between multiple Claude Code accounts without re-logging, by isolating configuration directories for each account.

I use separate Claude Code accounts for work and personal projects. Having to log out and go through the login flow every time I switched accounts became annoying, so I built a small CLI to solve it.<p>The commands are intentionally simple:<p>claude account add myworkaccount claude account add mypersonalaccount claude account use myworkaccount claude account current<p>After switching, Claude Code works normally:<p>claude claude &quot;fix this bug in main.py&quot; Repository: <a href="https:&#x2F;&#x2F;github.com&#x2F;hamzarehmandeveloper&#x2F;claude-account" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hamzarehmandeveloper&#x2F;claude-account</a><p>Give it a try
Original Article
View Cached Full Text

Cached at: 07/30/26, 04:50 PM

hamzarehmandeveloper/claude-account

Source: https://github.com/hamzarehmandeveloper/claude-account

claude-account

CI Release License: MIT

A Linux-only profile switcher for Claude Code. It gives Claude Code an isolated CLAUDE_CONFIG_DIR for each account and transparently forwards normal commands to the official Claude executable.

claude account add work
claude account add personal
claude account use work
claude account list
claude account current
claude account remove personal

claude
claude "fix this bug in main.py"

Claude Code itself performs login, logout, credential storage, and token refresh. claude-account never reads or copies credential contents.

This is an independent community project. It is not made, endorsed, or supported by Anthropic. Claude and Claude Code are products of Anthropic.

Requirements

  • Linux
  • A working Claude Code installation
  • Rust 1.85 or later to build from source

Install a release

Download claude-account-v0.1.1-x86_64-unknown-linux-gnu.tar.gz and its .sha256 file from the latest release, then verify and install it:

sha256sum --check claude-account-v0.1.1-x86_64-unknown-linux-gnu.tar.gz.sha256
tar -xzf claude-account-v0.1.1-x86_64-unknown-linux-gnu.tar.gz
./claude-account install

The installer prints one export PATH=... line. Add that line to ~/.bashrc and open a new terminal. The shim lives in its own directory; it does not replace the official Claude executable.

Confirm the installation:

type -a claude
claude account list

The claude-account shim should appear before the official Claude executable.

Build from source

git clone https://github.com/hamzarehmandeveloper/claude-account.git
cd claude-account
cargo build --locked --release
./target/release/claude-account install

Commands

Add an account

claude account add work
claude account add personal --email [email protected]
claude account add company --sso
claude account add api-billing --console

This opens Claude Code’s official login flow. The first profile becomes active. Adding another profile does not switch the active profile. The command also completes Claude Code’s local onboarding state, so the next claude launch uses the saved login without asking you to authenticate again.

Switch accounts

claude account use work

Switching affects newly launched Claude processes. Existing sessions keep the account with which they were started.

Inspect profiles

claude account list
claude account current

current prints only the profile name, making it safe to use in scripts.

Remove an account

claude account remove personal

This runs Claude Code’s official auth logout inside the profile and unregisters it. Settings and session history are preserved, allowing the same profile name to reuse them later.

To delete all local data belonging to the profile:

claude account remove personal --purge --yes

Removing the active profile is refused unless --force is supplied. --purge permanently deletes that profile’s settings, sessions, plugins, and history in addition to its stored login.

Get help

claude account --help
claude account add --help
claude account remove --help

All non-account commands and flags are passed unchanged to the official Claude executable:

claude
claude -p "explain this project"
claude --model opus
claude auth status --text

Storage

By default:

~/.config/claude-account/state.json
~/.local/share/claude-account/profiles/<name>/
~/.local/share/claude-account/bin/claude
~/.local/share/claude-account/libexec/claude-account

The standard XDG_CONFIG_HOME and XDG_DATA_HOME variables are respected. CLAUDE_ACCOUNT_HOME can place all application data under one absolute directory, which is especially useful for tests.

The state file contains profile names, directory paths, and the real Claude executable path. It never contains access or refresh tokens.

Authentication environment variables

To guarantee that the selected profile is actually used, the wrapper removes these variables from the child Claude process:

  • ANTHROPIC_API_KEY
  • ANTHROPIC_AUTH_TOKEN
  • CLAUDE_CODE_OAUTH_TOKEN

Set CLAUDE_ACCOUNT_PRESERVE_AUTH_ENV=1 if you intentionally want those variables to override profile authentication.

Development

cargo fmt --check
cargo test --locked --all-targets
cargo clippy --locked --all-targets -- -D warnings

See CONTRIBUTING.md for the contribution workflow and SECURITY.md for private vulnerability reporting.

License

Released under the MIT License.

Similar Articles

Claudy

Product Hunt

Claudy is a new tool designed as a proper home for Claude Code, supporting multi-session and multi-account management.

Multi-Claude

Product Hunt

Multi-Claude is a Mac tool that allows users to run multiple Claude AI accounts simultaneously for side-by-side use.

claude-share

Product Hunt

A tool to securely share Claude Code sessions with friends.

Claude Desktop spins up a VM without no way of stopping it

Hacker News Top

Claude Code is an agentic coding tool from Anthropic that lives in the terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows through natural language commands.