
S
ssh-copy-id
227
SSH
ssh-copy-id
CentOS
Ubuntu
Raspbian
WSL
openssh-client
書 式
ssh-copy-id [ オプション ] [ ユーザー名@] ホスト名
-i ファイル名 秘密鍵ファイルを指定する
-p ポート番号 ポート番号を指定する(デフォルトは 22 番ポート)
SSHの公開鍵をリモートホストに登録します。SSH で公開鍵認証を行うには、公開鍵を
接続先ホストの
~/.ssh/authorized_keysファイルに登録する必要があります。scpコマン
ドや
sshコマンドを使って手動で登録することもできますが、ssh-copy-id コマンドはその
処理を自動化します。
実行例
リモートホストsv1.example.com に公開鍵を登録する
$ ssh-copy-id sv1.example.com
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/north/.
ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to
filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) ...