Show HN: Claude-account – switch Claude Code accounts without logging in again
🛠️ Claude-account: Multi-Profile Management for Claude Code
Claude-account is a specialized utility designed exclusively for Linux users to seamlessly toggle between multiple, isolated Claude Code accounts. Instead of the tedious process of logging out and back in, this tool manages separate environments for different identities.
⚙️ How it Works
The tool acts as a "shim" (a wrapper). It assigns a unique CLAUDE_CONFIG_DIR to every profile you create and transparently forwards your commands to the actual Claude executable.
📋 Prerequisites
Before installing, ensure your system meets these criteria:
- OS: Linux
- Software: An existing installation of Claude Code
- Build Tools: Rust version
1.85or higher (only if building from source)
🚀 Installation Guide
Option A: Using a Pre-built Release
- Grab the
claude-account-v0.1.1-x86_64-unknown-linux-gnu.tar.gzand the corresponding.sha256file from the latest releases page. - Verify the integrity and install via the terminal:
# Verify checksum
sha256sum --check claude-account-v0.1.1-x86_64-unknown-linux-gnu.tar.gz.sha256
# Extract and install
tar -xzf claude-account-v0.1.1-x86_64-unknown-linux-gnu.tar.gz
./claude-account install
[!IMPORTANT] After installation, the tool will provide an
export PATH=...command. You must run this to add the shim to your environment.
This tool replaces the official Claude binary. Correction: The shim lives in its own directory and simply sits ahead of the official executable in your PATH.
Verify Installation:
type -a claude
claude account list
The claude-account path should be listed before the official Claude path.
Option B: Building from Source
git clone https://github.com/hamzarehmandeveloper/claude-account.git
cd claude-account
cargo build --locked --release
./target/release/claude-account install
🛠️ Command Reference
| Action | Command | Description |
|---|---|---|
| Add Profile | claude account add <name> | Starts the official login flow. |
| Add (Email) | claude account add <name> --email <email> | Specify a login email. |
| Add (SSO) | claude account add <name> --sso | Use Single Sign-On. |
| Add (Console) | claude account add <name> --console | Use console-based login. |
| Switch | claude account use <name> | Sets the active profile for new sessions. |
| List All | claude account list | Displays all configured profiles. |
| Check Current | claude account current | Returns only the active profile name (script-friendly). |
| Remove | claude account remove <name> | Logs out and unregisters the profile. |
Nuances of Account Management:
- Onboarding: When adding an account, the tool completes the local onboarding, meaning subsequent launches won't prompt for authentication.
- Session Persistence: Switching profiles only affects new Claude processes; active sessions remain tied to the account they started with.
- Data Deletion: By default,
removekeeps settings and history. To wipe everything:claude account remove <name> --purge --yes- Note: You cannot remove the active profile without the
--forceflag.
Passing Commands to Claude
Any command that isn't an account subcommand is passed directly to the official CLI:
claude "fix this bug in main.py"claude --model opusclaude auth status --text
📂 Technical Architecture
Storage Logic
The application follows XDG standards. The storage path can be mathematically represented as:
Default Paths:
- State:
~/.config/claude-account/state.json - Profiles:
~/.local/share/claude-account/profiles/ - Binaries:
~/.local/share/claude-account/bin/claude - Executables:
~/.local/share/claude-account/libexec/claude-account
Pro Tip: Use the CLAUDE_ACCOUNT_HOME environment variable to consolidate all data into one directory.
Authentication Isolation
To prevent environment leaks, the wrapper strips the following variables from the child process:
ANTHROPIC_API_KEYANTHROPIC_AUTH_TOKENCLAUDE_CODE_OAUTH_TOKEN
If you need these variables to override the profile settings, set CLAUDE_ACCOUNT_PRESERVE_AUTH_ENV=1.
👨💻 Development
For contributors, use the following workflow:
- Formatting:
cargo fmt --check - Testing:
cargo test --locked --all-targets - Linting:
cargo clippy --locked --all-targets -- -D warnings
Refer to CONTRIBUTING.md for the workflow and SECURITY.md for reporting vulnerabilities.