26. OSPN
公開鍵・秘密鍵の作成
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): (エンターキー)
Created directory '/home/user/.ssh'.
Enter passphrase (empty for no passphrase): (パスフレーズは非表示)
Enter same passphrase again: (パスフレーズは非表示)
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
b9:52:95:18:24:3c:83:91:9d:8d:76:06:0e:7a:b7:c2 user@centos6.example.com
↑フィンガープリントは公開鍵のハッシュ値
(略)
$ ls -l .ssh
合計 8
-rw-------. 1 user user 1743 11月 18 15:28 2015 id_rsa ←秘密鍵
-rw-r--r--. 1 user user 406 11月 18 15:28 2015 id_rsa.pub ←公開鍵
26
29. OSPN
sshコマンドで接続
$ ssh sshuser@server.example.com
The authenticity of host 'server.example.com
(192.168.0.102)' can't be established.
RSA key fingerprint is
e3:ea:71:a7:b6:e8:6b:2e:27:f9:83:a5:0f:63:95:13.
Are you sure you want to continue connecting
(yes/no)? yes ←yesと入力
Warning: Permanently added
'server.example.com,192.168.0.102' (RSA) to the
list of known hosts.
Enter passphrase for key
'/home/user/.ssh/id_rsa': (パスフレーズを入力。非表示)
[sshuser@server ~]$
29