ssh-copy-id(1)

ssh-copy-id1

Copy public keys to a remote host

Usage

ssh-copy-id [-lv] [-i keyfile] [-o option] [-p port] [user@] hostname

Overview

The ssh-copy-id utility copies public keys to a remote host's ~/.ssh/authorized_keys file (creating the file and directory, if required).

The following options are available:

-i file

Copy the public key contained in file. This option can be specified multiple times and can be combined with the -l option. If a private key is specified and a public key is found then the public key will be used.

-l

Copy the keys currently held by ssh-agent(1). This is the default if the -i option was not specified.

-o ssh-option

Pass this option directly to ssh(1). This option can be specified multiple times.

-p port

Connect to the specified port on the remote host instead of the default.

-v

Pass -v to ssh(1).

The remaining arguments are a list of remote hosts to connect to, each one optionally qualified by a user name.

Exit status

The ssh-copy-id utility exits 0 on success, and >0 if an error occurs.

Examples

To send a specific key to multiple hosts:

$ ssh-copy-id -i /path/to/keyfile.pub user@host1 user@host2 user@host3

Releases

30 releases since FreeBSD 10.0-RELEASE; the text changed 16 times.

  1. 10.0
  2. 10.1
  3. 10.2
  4. 10.3
  5. 10.4
  6. 11.0
  7. 11.1
  8. 11.2
  9. 11.3
  10. 11.4
  11. 12.0
  12. 12.1
  13. 12.2
  14. 12.3
  15. 12.4
  16. 13.0–13.2
  17. 13.3–16.0

-v since FreeBSD 10.1-RELEASE.

History

The ssh-copy-id utility was written by Eitan Adler ⟨[email protected]⟩ as a drop-in replacement for an existing utility included with OpenSSH.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.