各接続にはSSHキーが必要です

各接続にはSSHキーが必要です

サーバーに接続するためにコンピュータにSSHキーをインストールしましたが、他のサーバーに接続しようとすると、そのキーのパスワードを入力するように求められます。

ベストアンサー1

キーファイル名はどのように指定されますか?

インストールしたキーの名前がid_rsa/ id_rsa.pubetcの場合、サーバーは常にsshそれを使用してPubkeyAuthentication yes接続を試みます。/etc/ssh/sshd_config

このサーバーに接続するときにファイルのデフォルト名が変更された場合に使用する必要があります。それ以外の場合、キーがssh -i /path/to/key使用されるたびにsshキーが試行されます(主キー名のいずれかを使用する場合)。

~からman ssh

-i identity_file
             Selects a file from which the identity (private key) for public
             key authentication is read.  The default is ~/.ssh/identity for
             protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa,
             ~/.ssh/id_ed25519 and ~/.ssh/id_rsa for protocol version 2.
             Identity files may also be specified on a per-host basis in the
             configuration file.  It is possible to have multiple -i options
             (and multiple identities specified in configuration files).  If
             no certificates have been explicitly specified by the
             CertificateFile directive, ssh will also try to load certificate
             information from the filename obtained by appending -cert.pub to
             identity filenames.

おすすめ記事