1.秘密鍵と公開鍵の作成(コピー元サーバ)
# ssh-keygen -t rsa -N "" Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx root@ホスト名
2.公開鍵をコピー先サーバにコピーする
# scp -p ~/.ssh/id_rsa.pub xxx.xxx.xxx.xxx:~/.ssh/
3.公開鍵を~/.ssh/authorized_keysに追加する(コピー先サーバ)
*ディレクトリのアクセス権を間違えるとうまく動作しませんので注意!
# cd ~/.ssh # cat id_rsa.pub >> authorized_keys # rm id_rsa.pub # chmod 600 authorized_keys