ssh-keychain-access
Skill2 starsChanged 56 days agoMITView on GitHub
Use when helping establish SSH access through macOS Keychain credentials, especially emergency root SSH, password-to-key bootstrap, authorized_keys repair, or adding SSH private keys to the Apple keychain.
- Reads credentials
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-tooling-doctorSkill
- quality-gateSkill
- repo-onboardingSkill
- runtime-triageSkill
- security-checkSkill
- typescript-reviewSkill
- workspace-maintenanceSkill
- workspace-quality-gateSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 9 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill for SSH access recovery where credentials are in macOS Keychain.
- Very specific: line 12
Prefer SSH keys loaded with ssh-add --apple-use-keychain.
- Distinctive: line 13
Use a Keychain-stored password only as an emergency fallback or to bootstrap key-based access.
- Distinctive: line 14
Never print passwords, private keys, API keys, WHM credentials, or licence credentials.
- Very specific: line 15
Do not run security find-generic-password -w ...
- Very specific: line 16
Do not use sshpass -p, put passwords in command history, or disable host key checking.
- Distinctive: line 27
Add the private key to the macOS keychain:
- Distinctive: line 34
Test SSH with public-key auth:
- Distinctive: line 42
Run this only in the user's local terminal.
- Distinctive: line 59
Verify the item exists without printing the password:
- Distinctive: line 67
Use the bundled helper when password SSH is required and the password must come from Keychain without appearing in output:
- Distinctive: line 96
If password access works, use it only long enough to install a public key:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SSH Keychain Access
Use this skill for SSH access recovery where credentials are in macOS Keychain.
Security stance
- Prefer SSH keys loaded with
ssh-add --apple-use-keychain. - Use a Keychain-stored password only as an emergency fallback or to bootstrap key-based access.
- Never print passwords, private keys, API keys, WHM credentials, or licence credentials.
- Do not run
security find-generic-password -w ...as a standalone command that would expose the password in tool output. - Do not use
sshpass -p, put passwords in command history, or disable host key checking. - For root SSH, narrow the target to the specific host/IP and remove temporary access when recovery is complete.
Key-first workflow
Check loaded identities:
ssh-add -lAdd the private key to the macOS keychain:
chmod 600 /path/to/private_key ssh-add --apple-use-keychain /path/to/private_keyTest SSH with public-key auth:
ssh -o PreferredAuthentications=publickey user@host
Store a password in Keychain
Run this only in the user's local terminal. It avoids placing the password in shell history:
SERVICE="example-server-ssh"
ACCOUNT="admin@example-host"
printf 'Password for %s: ' "$ACCOUNT"
OLD_STTY=$(stty -g)
trap 'stty "$OLD_STTY"; unset SSH_PASSWORD' INT TERM EXIT
stty -echo
IFS= read -r SSH_PASSWORD
stty "$OLD_STTY"
printf '\n'
security add-generic-password -U -a "$ACCOUNT" -s "$SERVICE" -w "$SSH_PASSWORD"
unset SSH_PASSWORD
trap - INT TERM EXITVerify the item exists without printing the password:
security find-generic-password -a "$ACCOUNT" -s "$SERVICE"Use the helper
Use the bundled helper when password SSH is required and the password must come from Keychain without appearing in output:
shared/skills/ssh-keychain-access/scripts/ssh-keychain-login.sh \
--host example-host \
--user admin \
--service example-server-ssh \
--account admin@example-hostFor an unknown host key, verify the expected server host key out of band first. Only then re-run with:
--accept-new-host-keyTo run a one-off remote command, append it after --:
shared/skills/ssh-keychain-access/scripts/ssh-keychain-login.sh \
--host example-host \
--user admin \
--service example-server-ssh \
--account admin@example-host \
-- 'hostname; whoami'Bootstrap public-key access
If password access works, use it only long enough to install a public key:
ssh-keygen -t ed25519 -a 100 -f ~/.ssh/codex-whm-recovery-$(date +%Y-%m-%d) -C "codex-whm-recovery-$(date +%Y-%m-%d)"
ssh-add --apple-use-keychain ~/.ssh/codex-whm-recovery-$(date +%Y-%m-%d)
cat ~/.ssh/codex-whm-recovery-$(date +%Y-%m-%d).pubThen append only the public key to the server's authorized_keys, confirm public-key login works, and prefer key login for the rest of the session.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

