메뉴
HN
Hacker News • 57일 전

클로드 코드 계정 스위처: 재로그인 없이 계정 전환

IMP
7/10
핵심 요약

리눅스 환경의 개발자를 위해, 재로그인 없이 여러 클로드 코드(Claude Code) 계정을 빠르게 전환할 수 있는 오픈소스 커뮤니티 프로필 스위처 도구가 공유되었습니다. 이 도구는 계정별로 격리된 환경 변수(CLAUDE_CONFIG_DIR)를 설정하여 투명하게 공식 실행 파일로 명령을 전달하며, 보안상 인증 토큰 자체는 직접 읽거나 복사하지 않는 것이 특징입니다. 직장과 개인용 등 여러 계정을 번갈아 사용해야 하는 실무자들에게 작업 흐름을 크게 개선해 줄 유용한 유틸리티입니다.

번역된 본문

claude-account는 Claude Code 전용 리눅스 프로필 스위처입니다. Claude Code의 각 계정에 대해 격리된 CLAUDE_CONFIG_DIR 환경을 제공하며, 일반 명령어를 공식 Claude 실행 파일로 투명하게 전달합니다.

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 자체가 로그인, 로그아웃, 자격 증명 저장 및 토큰 새로고침을 수행합니다. claude-account는 절대 자격 증명 내용을 읽거나 복사하지 않습니다.

중요\n이것은 독립적인 커뮤니티 프로젝트입니다. Anthropic에서 제작, 보증 또는 지원하지 않습니다. Claude 및 Claude Code는 Anthropic의 제품입니다.

요구 사항\n* Linux\n* 정상적으로 설치된 Claude Code\n* 소스에서 빌드하려면 Rust 1.85 이상

릴리스 설치\n최신 릴리스에서 claude-account-v0.1.1-x86_64-unknown-linux-gnu.tar.gz 및 .sha256 파일을 다운로드한 다음, 무결성을 검증하고 설치합니다:\n```bash 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

설치 프로그램은 한 줄의 `export PATH=...` 명령을 출력합니다. 해당 줄을 `~/.bashrc`에 추가하고 새 터미널을 엽니다. 이 래퍼(Shim)는 자체 디렉터리에 존재하며 공식 Claude 실행 파일을 대체하지 않습니다.

설치를 확인합니다:\n```bash
type -a claude
claude account list

claude-account 래퍼가 공식 Claude 실행 파일보다 먼저 나타나야 합니다.

소스에서 빌드\n```bash git clone https://github.com/hamzarehmandeveloper/claude-account.git cd claude-account cargo build --locked --release ./target/release/claude-account install


**명령어**\n*   **계정 추가**: `claude account add work`, `claude account add personal --email you@example.com`, `claude account add company --sso`, `claude account add api-billing --console`\n  이 명령은 Claude Code의 공식 로그인 흐름을 엽니다. 첫 번째 프로필이 활성화됩니다. 다른 프로필을 추가해도 활성 프로필이 변경되지는 않습니다. 또한 Claude Code의 로컬 온보딩 상태를 완료하므로, 다음에 claude를 실행할 때 다시 인증하라는 메시지가 표시되지 않고 저장된 로그인을 사용합니다.
*   **계정 전환**: `claude account use work`\n  계정 전환은 새로 실행되는 Claude 프로세스에 영향을 미칩니다. 기존 세션은 시작될 때 사용한 계정을 그대로 유지합니다.
*   **프로필 조회**: `claude account list`, `claude account current`\n  `current`는 스크립트에서 사용해도 안전하도록 프로필 이름만 출력합니다.
*   **계정 제거**: `claude account remove personal`\n  이 명령은 프로필 내에서 Claude Code의 공식 인증 로그아웃을 실행하고 프로필을 등록 취소합니다. 설정 및 세션 기록은 보존되므로 나중에 동일한 프로필 이름을 재사용할 수 있습니다.\n  프로필의 모든 로컬 데이터를 삭제하려면: `claude account remove personal --purge --yes`\n  현재 활성 프로필은 `--force` 옵션을 제공하지 않는 한 제거가 거부됩니다. `--purge`는 저장된 로그인뿐만 아니라 해당 프로필의 설정, 세션, 플러그인 및 기록을 영구적으로 삭제합니다.

계정 관리와 관련 없는 모든 명령과 플래그는 공식 Claude 실행 파일로 변경되지 않고 그대로 전달됩니다:\n```bash
claude
claude -p " explain this project "
claude --model opus
claude auth status --text

저장소\n기본 경로:\n* ~/.config/claude-account/state.json\n* ~/.local/share/claude-account/profiles/<name>/\n* ~/.local/share/claude-account/bin/claude\n* ~/.local/share/claude-account/libexec/claude-account

표준 XDG_CONFIG_HOME 및 XDG_DATA_HOME 변수가 존중됩니다. CLAUDE_ACCOUNT_HOME을 사용하면 모든 애플리케이션 데이터를 단일 절대 경로 디렉토리에 배치할 수 있으며, 이는 테스트할 때 특히 유용합니다. 상태 파일에는 프로필 이름, 디렉터리 경로 및 실제 Claude 실행 파일 경로가 포함됩니다. 액세스 또는 새로고침 토큰은 절대 포함되지 않습니다.

인증 환경 변수\n선택한 프로필이 실제로 사용되도록 보장하기 위해 래퍼는 하위 Claude 프로세스에서 다음 변수를 제거합니다:\n* ANTHROPIC_API_KEY\n* ANTHROPIC_AUTH_TOKEN\n* CLAUDE_CODE_OAUTH_TOKEN

의도적으로 이 변수들이 프로필 인증을 우월하게(override) 적용하게 하려면 CLAUDE_ACCOUNT_PRESERVE_AUTH_ENV=1을 설정하십시오.

원문 보기
원문 보기 (영어)
claude-account 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. Important 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 you@example.com 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 .