次の手順によって公開鍵システムが設定され、クライアントの公開鍵が Secure Shell サーバー上での認証に使用できるようになります。また、ユーザーは、公開鍵と非公開鍵のペアを作成する必要があります。
この手順での「クライアント」および「ローカルホスト」という用語は、ユーザーが ssh コマンドを入力するシステムを指しています。「サーバー」および「リモートホスト」という用語は、クライアントが到達しようとするシステムを指しています。
始める前に
root 役割になる必要があります。詳細は、Oracle Solaris 11.3 でのユーザーとプロセスのセキュリティー保護 の 割り当てられている管理権利の使用を参照してください。
クライアントの構成ファイル /etc/ssh/ssh_config で、次のエントリを追加します。
HostbasedAuthentication yes
このファイルの構文については、ssh_config(4) のマニュアルページを参照してください。
サーバーの構成ファイル /etc/ssh/sshd_config で、同じエントリを追加します。
HostbasedAuthentication yes
詳細については、sshd(1M) のマニュアルページの「FILES」のセクションを参照してください。
client-host
client-host
/etc/ssh/sshd_config ファイルで、IgnoreRhosts を no に設定します。
## sshd_config IgnoreRhosts no
## sshd_config IgnoreUserKnownHosts no
ユーザーへの指示については、Secure Shell で使用する公開鍵と非公開鍵のペアを生成する方法を参照してください。
ホスト鍵は、/etc/ssh ディレクトリに格納されます。鍵は、通常、最初のブート時に sshd デーモンによって生成されます。
クライアントで、バックスラッシュなしで 1 行に次のコマンドを入力します。
# cat /etc/ssh/ssh_host_dsa_key.pub | ssh RemoteHost \ 'cat >> /etc/ssh/ssh_known_hosts && echo "Host key copied"'
Client and server could not agree on a key exchange algorithm: client "diffie-hellman-group-exchange-sha256,diffie-hellman-group- exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1", server "gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==". Make sure host keys are present and accessible by the server process. See sshd_config(4) description of "HostKey" option.
ファイルがコピーされると、「Host key copied」というメッセージが表示されます。
/etc/ssh/ssh_known_hosts ファイルの各行は、スペースで区切られたフィールドで構成されています。
hostnames algorithm-name publickey comment
hostnames フィールドに RemoteHost を配置します。
## /etc/ssh/ssh_known_hosts File RemoteHost <copied entry>
次の例では、各ホストが Secure Shell サーバーおよびクライアントとして構成されます。一方のホストのユーザーが、他方のホストへの ssh 接続を開始できます。次の構成によって、各ホストがサーバーおよびクライアントの両方になります。
ホストごとに、 Secure Shell 構成ファイルに次のエントリを入力します。
## /etc/ssh/ssh_config HostBasedAuthentication yes # ## /etc/ssh/sshd_config HostBasedAuthentication yes IgnoreRhosts no
ホストごとに、shosts.equiv ファイルに他方のホストに対するエントリを入力します。
## /etc/ssh/shosts.equiv on system2 machine1
## /etc/ssh/shosts.equiv on system1 machine2
各ホストの公開鍵を、他方のホストの /etc/ssh/ssh_known_hosts ファイルに入力します。
## /etc/ssh/ssh_known_hosts on system2 … machine1
## /etc/ssh/ssh_known_hosts on system1 … machine2
ユーザーは、両方のホストにアカウントを持ちます。たとえば、ユーザー Jane Doe の次の情報が表示されます。
## /etc/passwd on system1 jdoe:x:3111:10:J Doe:/home/jdoe:/bin/sh
## /etc/passwd on system2 jdoe:x:3111:10:J Doe:/home/jdoe:/bin/sh