今度こそsshのパスフレーズ省略

以前、リナザウからOpenBlockSへのsshパスフレーズ省略ができたつもりだったのだが、ホストベースで~/.shostsにIPを書く方法では、IPが変わってしまうとダメ。使い始めてすぐ気づいて、再び懸案リスト入りしていた。
偶然、会社で新しくセットアップしたFedoraCore6で、あっさりできていることに気づく。

[root@localhost ~]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key  (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
d7:db:14:21:52:9d:e2:b0:31:3e:d6:6e:41:ab:1d:68 root@localhost.localdomain
[root@localhost ~]# ssh-copy-id -i .ssh/id_dsa.pub hao@ho166.quattro.unisys.co.jp
15
Password:
Now try logging into the machine, with "ssh 'hao@ho166.quattro.unisys.co.jp'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[root@localhost ~]# ssh hao@ho166.quattro.unisys.co.jp
Linux colinux 2.6.10-co-0.6.2 #5 Sat Feb 5 10:19:16 IST 2005 i686 GNU/Linux

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

Last login: Tue Jan  9 03:57:16 2007 from 10.21.15.244
hao@colinux%                                                              [~]

リナザウにはssh-copy-idコマンドが無いので、手動でscp、cat id_dsa.pub >> authorized_keys してるが、基本的に同じ手順で繋がっている。何のことはない、ssh-keygenの時にpassphraseを入力してないからsshの時も入力を要求されないだけのことなのだが、ポイントは鍵の置き方を逆にしているところ。今までは、サーバの秘密鍵をクライアントにコピーしてsshの-iで指定していた。今回は、クライアントの公開鍵をサーバのauthorized_keysに登録している。前者の場合、サーバの鍵にpassphraseを付けないわけにはいかないが、クライアントの鍵ならまぁいいかなと。単に気分の問題だけ、いや、このキーペアさえあればどこからでもログインできてしまうので、無防備なリナザウに置いておくのはむしろ危険という気もするのだが...