SSH Keys and Agent Cheat Sheet/Install your public key on a server

Append your public key to a remote account's authorized_keys.

Section: Authorized Keys and Host Keys

Install your public key on a server

bash
bash
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@example.com
Explanation

Append your public key to a remote account's authorized_keys.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Authorized Keys and Host Keys
Install key on custom port
Use ssh-copy-id with a non-default SSH port.
OpenIn sheetbashsame section
Scan a host key
Fetch a server host key without logging in.
OpenIn sheetbashsame section
Add a host key to known_hosts
Append a scanned host key to your known_hosts file.
OpenIn sheetbashsame section
Find a host in known_hosts
Search known_hosts for a specific host entry.
OpenIn sheetbashsame section
Remove a host from known_hosts
Delete stale host key entries for a host.
OpenIn sheetbashsame section
Hash known_hosts file
Hash hostnames in known_hosts for privacy.
OpenIn sheetbashsame section