ssh-copy-id "ERROR: No identities found" and "All keys were skipped"
ssh-copy-id found no key: your agent is empty and there is no ~/.ssh/id*.pub. Create a key, or name the file with -i. All keys were skipped means already there.
ssh-copy-id adds your public key to ~/.ssh/authorized_keys on a host. Run without -i, it has to find the key itself, and if it finds nothing it stops before connecting:
/usr/bin/ssh-copy-id: ERROR: No identities found
Where ssh-copy-id looks
Without -i, the script checks two places, in this order:
- Your SSH agent. If
SSH_AUTH_SOCKis set andssh-add -Llists keys, it installs those. - *The newest `~/.ssh/id.pub
file**, for exampleid_ed25519.puborid_rsa.pub. Certificate files ending in-cert.pub` are skipped.
So you get "No identities found" when the agent is empty or not running and there is no file whose name starts with id in ~/.ssh. A key saved under another name, such as ~/.ssh/work_key.pub, is never found on its own.
Fixes
- Name the key.
ssh-copy-id -i ~/.ssh/work_key.pub [email protected]. You can leave off.pub; the script adds it. - No key yet? Create one first with
ssh-keygen -t ed25519. It saves~/.ssh/id_ed25519and~/.ssh/id_ed25519.pub, which ssh-copy-id then finds. - Check the agent.
ssh-add -lshows what the agent holds. If you rely on it, add the key withssh-add ~/.ssh/work_key.
"failed to open ID file"
With -i, ssh-copy-id also checks that it can read the private key next to the .pub file, and stops with "failed to open ID file" if it cannot. Its message points to -f, which installs the public key without that check and without testing which keys are already installed.
"All keys were skipped because they already exist on the remote system."
Before copying, ssh-copy-id tries to log in with each key. A key that already works is left out, and if none are left it prints this warning and exits without changing anything. If you still cannot log in with that key, the problem is elsewhere, for example file permissions on the host: see Authorized keys and permissions.
Related
- ssh-copy-id through a jump host (ProxyJump)
- Authorized keys and permissions
- Key types and formats
- ssh-add "Could not open a connection to your authentication agent": start the agent
- SSH error messages, what each one means