ssh-access
Use when creating SSH keys or an ssh alias for a host. Ed25519 keys with a passphrase, installing the public key, a ~/.ssh/config Host block, 700/600 permissions, agent forwarding caution, rotation, a
SKILL.mdiclone/skills/ssh-access/SKILL.md
GitHubSSH access — keys and aliases done safely
When to use
- The owner needs to reach a server (new VPS, a rebuilt host, a second machine) or wants a short alias for it.
- A key must be rotated, or a login fails with
Permission denied (publickey).
For GitHub keys use the github skill (references/auth.md). ssh, ssh-keygen, ssh-copy-id are system tools: their man pages are the truth.
Prerequisites
- OpenSSH client (built into macOS and Linux).
- Creating keys or editing
~/.sshwrites files: ask through the consent door (~/.iclone-os/bin/acp consent request fileWriting --reason "…"), say which file, and wait for the owner's yes. Commands on a server also needterminal.
Quick reference
| Item | Rule |
|---|---|
| Type | ed25519 (RSA only for legacy hosts, 4096 bits) |
| Passphrase | yes for personal keys; typed by the owner, never by you |
| Files | ~/.ssh 700 · private key and config 600 · .pub 644 |
| One key per purpose | personal login ≠ deploy key ≠ CI key |
| Alias | Host <alias> block with IdentitiesOnly yes |
Procedure
- Look for an existing key before making a new one:
ls -l ~/.ssh/*.pub # example
- Create the key. The owner types the passphrase at the prompt; never pass one with
-Non the command line (it lands in shell history):
ssh-keygen -t ed25519 -a 100 -C "<label>" -f ~/.ssh/<key-name> # example
On macOS, store the passphrase in the login keychain once:
ssh-add --apple-use-keychain ~/.ssh/<key-name> # example
- Put the PUBLIC key on the server — in the provider panel for a new server, or over a login that already works:
ssh-copy-id -i ~/.ssh/<key-name>.pub <user>@<server-ip> # example
- Add the alias to
~/.ssh/config(append; never rewrite the owner's existing blocks):
# example — man ssh_config is the truth
Host <alias>
HostName <server-ip>
User <user>
IdentityFile ~/.ssh/<key-name>
IdentitiesOnly yes
ServerAliveInterval 30
ForwardAgent no
On macOS add UseKeychain yes and AddKeysToAgent yes to the block.
5. Fix permissions (ssh refuses keys that others can read):
chmod 700 ~/.ssh && chmod 600 ~/.ssh/config ~/.ssh/<key-name> && chmod 644 ~/.ssh/<key-name>.pub # example
- Test without prompts:
ssh -o BatchMode=yes <alias> true; echo $? # example
- Rotate: create the new key (step 2) → append its
.pubto~/.ssh/authorized_keyson the server → log in with the new key in a new session → only then remove the old line fromauthorized_keys→ updateIdentityFile→ delete the old local key with the owner's yes.
Pitfalls
Too many authentication failures: the agent offered every key;IdentitiesOnly yesfixes it.REMOTE HOST IDENTIFICATION HAS CHANGED: stop. Ask the owner whether the server was rebuilt. Only then runssh-keygen -R <server-ip>and accept the new fingerprint shown in the provider console.ForwardAgent yeslets anyone with root on that host use your keys while you are connected; preferProxyJumpfor bastions.- A server that must pull from GitHub gets its own deploy key created ON the server, never a copy of a personal key.
Never
- Never print, read aloud, upload or copy a private key (any file in
~/.sshwithout.pub). - Never set
StrictHostKeyChecking noorUserKnownHostsFile /dev/null. - Never delete a key or an
authorized_keysline before the replacement login works.
Verification
ssh -G <alias> | grep -E '^(hostname|user|identityfile|identitiesonly) ' && ssh -o BatchMode=yes <alias> true && echo ok # example
Pass = the resolved values match the block and the last command prints ok (exit code 0).