2010/07/30

公開鍵の作り方

sftpなどのための公開鍵の作り方についてまとめておきます。
$ whoami
(ユーザー名)
$ ssh-keygen -t rsa //カギを作成する
Generating public/private rsa key pair.
Enter file in which to save the key (/home/(ユーザー名)/.ssh/id_rsa):
Created directory '/home/(ユーザー名)/.ssh'.   
Enter passphrase (empty for no passphrase): //パスワードを入力
Enter same passphrase again: //もう一度パスワードを入力
Your identification has been saved in /home/(ユーザー名)/.ssh/id_rsa.
Your public key has been saved in /home/(ユーザー名)/.ssh/id_rsa.pub.
The key fingerprint is:
ff:8a:6b:d8:eb:ad:68:90:33:eb:2c:6c:d8:ea:98:41 (ユーザー名)@(PC名)
$ ls -la ~/.ssh //確認
合計 16
drwx------    2 xxx     xxx         4096 Feb  2 13:53 ./
drwx------   22 xxx     xxx         4096 Feb  2 13:53 ../
-rw-------    1 xxx     xxx          951 Feb  2 13:53 id_rsa     //秘密鍵
-rw-r--r--    1 xxx     xxx          236 Feb  2 13:53 id_rsa.pub //公開鍵
$ mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys //authorized_keysにリネーム

0 件のコメント: