---
name: "ssh-copy-id"
section: "1"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/ssh-copy-id"
---

# ssh-copy-id(1)

copy public keys to a remote host

## NAME

**ssh-copy-id** – copy public keys to a remote host

## SYNOPSIS

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

## DESCRIPTION

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)](/ssh-agent/1.md). This is the default if the **-i** option was not specified.

- **-o** *ssh-option*

  Pass this option directly to [ssh(1)](/ssh/1.md). 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)](/ssh/1.md).

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
```

## HISTORY

The **ssh-copy-id** utility was written by Eitan Adler ⟨*eadler@FreeBSD.org*⟩ as a drop-in replacement for an existing utility included with OpenSSH.
