Feb 01, 2006

SSHでHostbasedAuthenticationの再設定

rsyncのためのSSHでHostbasedAuthenticationの再設定で、2〜3日ハマった。
Vine3.0で設定してあった「sshd_config」とクライアントマシンである、Debian GNU/Linux sargeの「ssh_config」は共にプリントしてあったので、そのとおりにしたのに、HostbasedAuthenticationでパスワードなしの接続ができない。
バックアップのための肝心要のものなので、早めに解決しなければならない。
結論からいえば、rysnc設定のメモで書いた「.shosts」(ユーザのホームディレクトリに置く。アクセスモード644)の記述に、ホスト、サーバともに次のようにIPアドレスだけでなく名前も追加したら解決した。これを発見するまでにじたばたしたわけである。この記述法は、インターネットでは情報が載っていなくてぼくが試みたらうまくいったという事柄である。
192.168.0.5 shimirin
i.love.belle.cxm shimirin
前には上の1行だけ書けばうまくHostbasedAuthenticationができていたのに不思議である。なお、Debian GNU/Linux sargeの現在の状態だと、sshdの再起動のコマンドは「/etc/init.d/ssh restart」で「sshd restart」ではない。また「rsync」はデスクトップをインストールしたときに自動でインストールされないので「apt-get install rsync」としてインストールする必要がある。
SSHの再設定で、設定ファイルを見直した。要の部分を書いてみる。
「/etc/ssh/ssh_config」(クライアント側、双方向なら両方)。
HostbasedAuthentication yes
EnableSSHKeysign yes
PreferredAuthentications hostbased,publickey,password
IdentitiyFile ~/.ssh/id_rsa
真ん中の2行は書き加える。
「/etc/ssh/sshd_config」(要の部分だけ。ホスト側、双方向なら両方)。
PermitRootLogin no
StrictModes yes
RSAAuthentication no
PubkeyAuthentication yes(noでもいいが、設定を実験しているときは下のPasswordAuthenticationとともにyes)
RhostsRSAAuthentication no
HostbasedAuthentication yes
IgnoreRhosts no
IgnoreUserKnownHosts no
PasswordAuthentication yes(でもnoでもいいが、noが推奨かも。なぜなら、クライアント側の認証の試みの順序が最初にhostbaseになっていればうまくいけば関係ないから。hostbaseが失敗した場合、外部公開している場合はセキュリティ上、noのがいい)
PermitEmptyPasswords no
ChallengeResponseAuthentication no
UsePam no
全体的にいえば、上の設定でRSA1のバージョンでなく、RSA2を使い、認証にHostbasedAuthentication(RSA2のみ)を使うことを設定している。

WriteBacks
TrackBack ping me at
http://www.haizara.net/~shimirin/blosxom/blosxom.cgi/computer/linux/20060201082223.trackback
Post a comment

writeback message: Ready to post a comment.













Captcha:
To prevent comment spam, please retype the characters in this image:

Enter the text here: