Use ssh-copy-id with a non-default SSH port.
Section: Authorized Keys and Host Keys
Install key on custom port
bash
bash
ssh-copy-id -i ~/.ssh/id_ed25519.pub -p 2222 user@example.comExplanation
Use ssh-copy-id with a non-default SSH port.
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 your public key on a server
Append your public key to a remote account's authorized_keys.
Add a host key to known_hosts
Append a scanned host key to your known_hosts file.