Ssh agent
Skill kylebrodeur/1password-ssh-setup/packages/pi-1password/skills/ssh-agent
Complete system for managing SSH keys and secrets using 1Password CLI with Pi coding agent integration. Features Service Account authentication, cascading environments, and SSH agent keychain.
npx -y skills add kylebrodeur/1password-ssh-setup --skill ssh-agentAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
SSH agent management with 1Password for passphrase handling and keychain integration. Use when working with SSH keys on Linux/WSL/Windows. Features keychain-based key persistence and 1Password-stored passphrases for secure, passwordless SSH operations.
SKILL.md
4.6 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
SSH Agent Skill
Setup
Prerequisites
-
1Password CLI (
op)# macOS brew install 1password-cli # Linux/WSL # Download from: https://1password.com/downloads/command-line/ -
Keychain for SSH agent management
# macOS brew install keychain # Linux (usually pre-installed) sudo apt-get install keychain -
1Password Service Account (required)
- Create at https://op.serviceaccounts.1password.com
- Add to
~/.zshrc:export OP_SERVICE_ACCOUNT_TOKEN="your-token"
SSH Key Setup
-
Ensure you have an SSH key:
# Generate if needed ssh-keygen -t ed25519 -C "[email protected]" -
Store the key's passphrase in 1Password:
- Create a new item (e.g., "my-ssh-key")
- Add the passphrase to the Password field
- Save as a Password field type
-
Update
~/.ssh/askpass-1password.sh:SSH_KEY_REFERENCE="op://Private/my-ssh-key/password"
Features
Automatic SSH Agent Setup
The setup script (~/.ssh/setup_ssh_agent.sh) automatically:
- Starts keychain SSH agent
- Loads your SSH key with 1Password passphrase
- Sets environment variables for the session
SSH_ASKPASS Integration
When configured, SSH prompts for passphrases are handled by:
- The 1Password helper script reads from 1Password
- The passphrase is never stored in plaintext
- Keychain caches the unlocked key for the session
Keychain Integration
- Keys are unlocked once per session
- Keychain persists the unlocked state
- No password prompts for subsequent SSH operations
Usage
Manual Setup
If not using the automated installer, add to your shell config:
# 1Password CLI (Required first)
export PATH="$HOME/.local/bin:$PATH"
# 1Password Session Manager (Required before SSH)
if [[ -f "$HOME/.config/op-ssh/op-session-manager.sh" ]]; then
source "$HOME/.config/op-ssh/op-session-manager.sh"
fi
# SSH Keychain with 1Password
_ssh_setup_script="${HOME}/.ssh/setup_ssh_agent.sh"
if [[ -f "$_ssh_setup_script" ]]; then
source "$_ssh_setup_script"
fi
Check SSH Agent Status
# List loaded keys
ssh-add -l
# Test SSH connection
ssh -T [email protected]
Manually Unlock a Key
# Force unlock with 1Password
export SSH_ASKPASS_REQUIRE="prefer"
export SSH_ASKPASS="${HOME}/.ssh/askpass-1password.sh"
ssh-add ~/.ssh/id_ed25519
Files and Directories
~/.ssh/
├── askpass-1password.sh # SSH_ASKPASS helper script
├── setup_ssh_agent.sh # Keychain initialization script
└── id_ed25519* # Your SSH key(s)
~/.config/op-ssh/
├── .env.1pass # User-level environment
└── op-ai-helper.sh # Helper functions
/opt/local/bin/ # Or ~/.local/bin/
└── op-reference # 1Password CLI wrapper
Platform-Specific Notes
WSL (Windows Subsystem for Linux)
- 1Password desktop app on Windows handles authentication
- SSH Agent enabled in 1Password desktop Settings > Developer
- Socket at:
/mnt/c/Users/kyleb/AppData/Local/1Password/sockets/
Native Windows
- Windows OpenSSH agent uses 1Password SSH Agent
- Ensure Windows SSH Agent service is disabled
- 1Password takes over the SSH agent pipe
macOS
- Keychain is pre-installed
- SSH_ASKPASS uses macOS native helpers when available
Troubleshooting
SSH keeps asking for passphrase
Solution: Check SSH_ASKPASS is set correctly:
echo $SSH_ASKPASS
echo $SSH_ASKPASS_REQUIRE
"Keychain has no keys in memory"
Solution: Restart keychain:
keychain --clear
# Then start a new shell or run:
source ~/.ssh/setup_ssh_agent.sh
"No reference provided"
Solution: Update ~/.ssh/askpass-1password.sh
with a valid 1Password secret reference
"Not signed in to 1Password"
Solution: Set OP_SERVICE_ACCOUNT_TOKEN in ~/.zshrc
Keychain Commands
# List active keys
keychain --list
# Clear all keys
keychain --clear
# Show keychain status
keychain --status
# Add specific key
keychain --add ~/.ssh/id_ed25519
# Check key loaded
ssh-add -l
Original Article
Based on: "Combining Keychain and 1Password CLI for ssh-agent management" by Bas Nijholt.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.