← ClaudeAtlas

ssh-keychain-unlocklisted

Use when Claude Code auth fails over SSH on macOS, keychain is locked in headless/remote sessions, or setting up Claude Code on a Mac for remote access
soulmachine/skills · ★ 2 · AI & Automation · score 75
Install: claude install-skill soulmachine/skills
# SSH Keychain Unlock for Claude Code on macOS ## Overview Claude Code stores credentials in the macOS Keychain (`Claude Code-credentials` service). When accessing a Mac via SSH (no GUI session), the login keychain is locked, causing Claude Code to appear unauthenticated. ## When to Use - Claude Code says it's not logged in when accessed via SSH - `security show-keychain-info ~/Library/Keychains/login.keychain-db` shows the keychain is locked - Setting up a Mac Mini or headless Mac for remote Claude Code usage ## Solutions ### Option 1: Interactive Unlock on SSH Login Add to `~/.zshrc`: ```bash # Unlock macOS keychain for SSH sessions (needed for Claude Code auth) if [[ -n "$SSH_CONNECTION" ]]; then security unlock-keychain ~/Library/Keychains/login.keychain-db 2>/dev/null fi ``` Prompts for macOS login password each SSH session. Simple but requires manual input. ### Option 2: Auto-Unlock at Boot (Headless) For fully headless operation with no password prompt: **1. Create password file** (`~/.claude/.keychain-password`, permissions `600`): ```bash echo 'YOUR_MACOS_PASSWORD' > ~/.claude/.keychain-password chmod 600 ~/.claude/.keychain-password ``` **2. Create unlock script** (`~/.claude/unlock-keychain.sh`, permissions `700`): ```bash cat > ~/.claude/unlock-keychain.sh << 'SCRIPT' #!/bin/bash security unlock-keychain -p "$(cat ~/.claude/.keychain-password)" ~/Library/Keychains/login.keychain-db SCRIPT chmod 700 ~/.claude/unlock-keychain.sh ``` **3. Create Launc