間違っていたから修正
ローカルホスト(クライアント)でやることとリモートホスト(サーバ)でやることがごっちゃになってた。なんか上手に修正ができないので、ざっくりと間違った部分を削除して新しく付け加える。
まずはローカルホストで ssh-keygen で鍵を作る。
paraches-g5:~ paraches$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/Users/paraches/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/paraches/.ssh/id_dsa. Your public key has been saved in /Users/paraches/.ssh/id_dsa.pub. The key fingerprint is: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx paraches@paraches-g5.local
xx は16進が並んでる。
で、次に ssh-copy-id で id_dsa.pub をリモートホストにコピーするのだけど…
paraches-g5:~ paraches$ ssh-copy-id -i ~/.ssh/id_dsa.pub paraches@192.168.11.4 -bash: ssh-copy-id: command not found
Mac OS X には ssh-copy-id 無いって。仕方がないので手でコピー。
paraches-g5:~ paraches$ scp ~/.ssh/id_dsa.pub paraches@192.168.11.4:tmp Password: id_dsa.pub 100% 623 0.6KB/s 00:00
次にリモートホストにログインして、tmp を authorized_keys へ加える。
paraches@debian:~$ cat tmp > ~/.ssh/authorized_keys -bash: /home/paraches/.ssh/authorized_keys: そのようなファイルやディレクトリはありません paraches@debian:~$ ls ~/.ssh ls: /home/paraches/.ssh: そのようなファイルやディレクトリはありません
あり? .ssh ないよ。じゃぁ mkdir で作って…
paraches@debian:~$ mkdir .ssh paraches@debian:~$ cat tmp > ~/.ssh/authorized_keys
で OK。
再度リモートホストへログインしてみる。
paraches-g5:~ paraches$ ssh 192.168.11.4 Enter passphrase for key '/Users/paraches/.ssh/id_dsa':
ちゃんとパスフレーズ聞かれる。これで OK。