[BUG] CLAUDE_CONFIG_DIR does not isolate credentials on Linux/WSL2 (no Keychain)

Resolved 💬 3 comments Opened Apr 13, 2026 by zeroarst Closed May 24, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

On Linux / WSL2, setting CLAUDE_CONFIG_DIR to a custom directory (e.g. ~/.claude-personal) does not isolate credentials. Claude Code always reads ~/.claude/.credentials.json from the default location, ignoring the profile-specific credentials file.

The credentials file does get written to the custom directory (~/.claude-personal/.credentials.json) during claude auth login, but on subsequent launches Claude Code falls through to ~/.claude/.credentials.json instead of reading from the configured directory.

This makes multi-account workflows (e.g. work account + personal account) broken on Linux because there is no system Keychain to fall back on — credentials are stored purely in the file system, but the file path resolution is incorrect.

What Should Happen?

When CLAUDE_CONFIG_DIR is set to a custom path (e.g. ~/.claude-personal), Claude Code should read and use the credentials file at $CLAUDE_CONFIG_DIR/.credentials.json (~/.claude-personal/.credentials.json), not fall back to ~/.claude/.credentials.json.

Two separate instances launched with different CLAUDE_CONFIG_DIR values should run under fully isolated accounts simultaneously.

Error Messages/Logs

No explicit error — Claude Code silently uses the wrong credentials file and authenticates as the wrong account.

Steps to Reproduce

  1. Set CLAUDE_CONFIG_DIR=~/.claude-personal and run claude auth login to authenticate a second account
  2. Confirm ~/.claude-personal/.credentials.json exists and contains the second account's credentials
  3. Launch a new session: CLAUDE_CONFIG_DIR=~/.claude-personal claude
  4. Observe that Claude Code authenticates as the first (default) account instead of the second — it is reading ~/.claude/.credentials.json, not ~/.claude-personal/.credentials.json

Claude Code Version

Latest (please confirm with claude --version)

Platform

Anthropic API

Operating System

Other Linux / WSL (Windows Subsystem for Linux)

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

  • On macOS this works correctly because credentials are stored in the system Keychain, keyed per config directory
  • On Linux/WSL2 there is no Keychain, so credentials live in .credentials.json — the path resolution bug is exposed
  • Current workaround: manually symlink-swapping ~/.claude.json and ~/.claude/.credentials.json before each launch, but this is not parallel-safe and prevents running two accounts simultaneously
  • Related discussion: https://github.com/anthropics/claude-code/issues/30031#issuecomment-2798764155

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗