SSH: CC_ENV_EXTRACT_LIST missing SSH_AUTH_SOCK breaks 1Password SSH agent
Status Open
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 12 comments · opened Mar 1, 2026
Summary
Claude Code Desktop has two issues that break SSH connections for users of 1Password SSH agent (and likely other non-default SSH agents):
SSH_AUTH_SOCKnot imported from shell environment: TheCC_ENV_EXTRACT_LISTwhitelist inshellPathWorker.jsdoes not includeSSH_AUTH_SOCK. Claude Desktop always inherits the macOS default SSH agent socket (/private/tmp/com.apple.launchd.*/Listeners) instead of the user-configured agent.
IdentityFilepointing to a.pubfile crashes ssh2: 1Password's auto-generated SSH config setsIdentityFileto a.pubfile (the agent handles the actual private key). Claude Desktop reads this file and passes it to ssh2 asprivateKey, which throws"privateKey value does not contain a (valid) private key"instead of falling through to agent-based auth.
Steps to Reproduce
- Configure 1Password SSH agent (standard setup:
SSH_AUTH_SOCKin shell profile +Include ~/.ssh/1Password/config+IdentityAgentin~/.ssh/config) - Verify
sshworks from terminal - Add an SSH connection in Claude Desktop
- Try to connect → fails with "privateKey value does not contain a (valid) private key" or falls back to password auth
Workaround
Both of the following are needed:
- In the SSH connection settings UI, set the Identity File field to
none— this prevents ssh2 from reading the.pubfile - Launch Claude Desktop from terminal:
SSH_AUTH_SOCK=~/.1password/agent.sock open -a Claude
Suggested Fix
- Add
"SSH_AUTH_SOCK"toCC_ENV_EXTRACT_LISTinshellPathWorker.js - When an
IdentityFilefails to parse as a private key, skip it and fall through to agent auth instead of throwing
Environment
- macOS Tahoe 26.3
- Claude Desktop (latest as of 2026-02-28)
- 1Password SSH agent
🤖 Generated with Claude Code
Showing cached comments. Read the full discussion on GitHub ↗
11 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Not a duplicate of the linked issues. Those are about plugin marketplace git clone operations failing with 1Password. This issue is specifically about SSH remote connections (connecting to remote hosts via Claude Desktop) failing due to two distinct bugs:
SSH_AUTH_SOCKnot being imported from the user's shell environment (CC_ENV_EXTRACT_LISTinshellPathWorker.js).pubIdentityFile instead of falling through to agent authDifferent feature, different code paths, different workarounds.
🤖 Generated with Claude Code
Analysis:
The 1Password SSH agent integration issue has two distinct failure modes that need separate fixes:
Issue 1: SSH_AUTH_SOCK Import
The environment variable whitelist in
shellPathWorker.jsis too restrictive. BesidesSSH_AUTH_SOCK, there are other agent-related variables that should probably be considered:SSH_AUTH_SOCK(primary)SSH_AGENT_PID(for spawned ssh-agent processes)SSH_CONNECTION/SSH_TTY(for nested sessions)GPG_AGENT_INFO(for GPG agent forwarding)A broader fix might be to allow
SSH_*prefix variables, with an explicit denylist for security-sensitive ones likeSSH_ASKPASSif there's concern about prompt hijacking.Issue 2: IdentityFile Parsing
The ssh2 library's key parsing fails hard when encountering a
.pubfile. The fix should:ssh-rsa,ssh-ed25519, etc., it's a public keynonekeyword — the workaround suggests this already works in the UIThe workaround of launching from terminal with
SSH_AUTH_SOCKexplicitly set confirms the socket path resolution is the core issue — once that's fixed, the IdentityFile issue becomes secondary (agent auth would succeed before file parsing is attempted).This has been marked as stale but it is a pretty important workflow issue.
This issue is a blocker for me, as my dev environment is a remote server and my SSH keys live in 1Password. I'd love to be able to use Claude Desktop locally, so I have the friendlier UI.
For context: I'm running Windows 11 locally and Ubuntu 24 remotely.
I think this is a pretty important feature as storing private key on filesystem is a risk and many people should migrate to storing their private keys to secure places
Adding another data point — this is also a blocker for me.
Setup: macOS, 1Password SSH Agent, server with
publickey-only auth.What I found debugging from Claude Code CLI:
ssh-add -linside Claude Code sandbox →Error connecting to agent: Operation not permitted(sandbox blocks Unix socket access)ssh-add -lwith sandbox disabled → keys from 1Password are visible and SSH works fineRoot cause confirmed: Desktop's
ssh2library never reaches the 1Password agent socket. TheIdentityAgentdirective in~/.ssh/configis ignored, andSSH_AUTH_SOCKis not passed through.Impact: Users who follow security best practices (keys in 1Password, no private key files on disk) cannot use SSH Remote at all. The workaround of launching from terminal with
SSH_AUTH_SOCKdoesn't reliably work either, sinceopen -agoes through LaunchServices.This has been open for a month with no assignee. Would appreciate if someone from the team could pick this up — it's a two-line fix for the env var whitelist, and a small try/catch for the
.pubfile parsing.Trying to day with the new claude desktop for windows, I use Bitwarden desktop for my ssh key stores. Using windows ssh and python ssh whenever I connect my bitwarden pops up and asks me to authorize the connection using the key saved in my bitwarden. Claude Desktop does not trigger this same result, and just fails the ssh connection.
thx
Claude itself investigated and here is what it says:
Same root cause on Windows + Bitwarden SSH agent (not macOS, not 1Password), which suggests this is cross-platform in the ssh2 client layer, not specific to
CC_ENV_EXTRACT_LIST.Environment
1.2581.0.0(MSIX:Claude_1.2581.0.0_x64__pzs8sxrjxfjjc)\\.\pipe\openssh-ssh-agentProof from
%APPDATA%\Claude\logs\ssh.log:[SSH2Connection] Resolved root@host -> root@host:22 (identityFiles: 7)
[SSH2Connection] Connecting to root@host:22 (agent: false, key: false, proxy: false, keyboard: true)
[SSH2Connection] Connection error: All configured authentication methods failed
Note
agent: false— Claude Desktop never queries the agent pipe, so Bitwarden never fires its approval popup.Comparison — at the same moment, system
ssh.exe(OpenSSH_for_Windows_9.5p2) against the same host authenticates fine via Bitwarden:debug1: get_agent_identities: agent returned 3 keys
debug1: Will attempt key: <keyname> ED25519 ... agent
debug1: Offering public key: <keyname> ED25519 ... agent
debug1: Server accepts key: <keyname> ED25519 ... agent
Authenticated to host ([x.x.x.x]:22) using "publickey".
Windows-specific fix note: alongside
SSH_AUTH_SOCKon macOS/Linux, the Windows agent uses a named pipe at\\.\pipe\openssh-ssh-agent(same path regardless of which agent implementation owns it — Windows OpenSSH, Bitwarden, 1Password, etc.). When wiring ssh2'sagentoption, use that pipe path onwin32:I closed #46273 (SSH_AUTH_SOCK passthrough) as a duplicate of this, but I'm a bit worried the enterprise angle is getting overlooked.
The same fix (SSH_AUTH_SOCK in CC_ENV_EXTRACT_LIST, skip unparseable IdentityFile entries) also unblocks PKCS#11 hardware tokens (YubiKey PIV, PIV/CAC smart cards) and FIDO sk-* keys when loaded into ssh-agent — direct PKCS#11 use without an agent (PKCS11Provider in ~/.ssh/config) would need the OS ssh path. For enterprises whose key-custody policy prohibits software-held private keys, Claude Desktop's SSH dialog is a compliance blocker.
Longer-term, driving the OS ssh binary would inherit OpenSSH's full config surface (agent forwarding, PKCS11Provider, IdentityAgent, ProxyCommand, Match, GSSAPI, etc.) — though I realize that's a bigger change than the one above.
Happy to reopen/reformulate #46273 if you'd rather track it separately.
Adding a deeper diagnosis for bug #2 in @jvkamp's split (ssh2 rejecting
.pubIdentityFiles instead of falling through to agent auth) — filed separately as #53502 then realised it's covered here. Closing that one; pasting the extra detail in case it helps whoever picks this up.Why the wrapper rejects
.pubstubsThe bundled per-identity loader returns the raw file bytes to be used as
privateKey:.pubstubs parse fine (valid public keys), so the guard doesn't fire. They then hitssh2.Client.connect:The thrown string is not
"authentication methods failed", so the surrounding fallback loop short-circuits and the agent path is never tried — even ifSSH_AUTH_SOCKis set correctly.The "works on host A, fails on host B" asymmetry
ssh -Gresolution is cached in an in-memory Map for the lifetime of the Claude Code process. Whether a host hits the bug depends on whether itsIdentityFileexisted on disk at first-resolution time:fs.readFilefails →t4ereturns undefined → identity-files array empty → agent gate!(identitiesOnly && !hasFiles)is truthy → agent auth succeeds.Restarting Claude Code can flip a previously-working host into a broken state, which makes this confusing to diagnose in the wild.
Suggested one-line fix in
t4eThat makes 1Password's
.pub-stub layout (and any other agent-only setup) Just Work without theIdentitiesOnly no+IdentityFile noneworkaround on every host.Current two-part workaround (both halves required)
~/.ssh/config:``
``Host <affected-hosts>
IdentitiesOnly no
IdentityFile noneat the bottom of each affectedHostblock (resets the identity-files list —ssh -Ghonoursnone, and the wrapper's parser does too).Clearing the file list alone disables the agent gate; clearing
IdentitiesOnlyalone still runs the buggy public-key-as-privateKey path.Environment
Match Hostrules pinning per-host ed25519 keys exposed as~/.ssh/1Password/SHA256_<hash>.pub@rjlg's two part workaround worked for me, plus a tweak to
~/.config/1Password/ssh/agent.tomlto present a specific key of many firstYou can see the list of keys with
SSH_AUTH_SOCK="$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" ssh-add -L