仮想マシンでSSH接続時にパスワードのない秘密鍵のパスワード要求

仮想マシンでSSH接続時にパスワードのない秘密鍵のパスワード要求

特定の仮想マシンにログインすると、SSHを介してサーバーに接続する際にいくつかの問題があります。

私のローカルPCでは、次のコマンドを使用してサーバーにログインできますssh -i .ssh/[my private key] username@domain

次に、関連しない他のサーバー(同じ秘密鍵を持つ)にSSHを介して接続し、上記のコマンドを実行すると、そのサーバーに正常にログインします。

ただし、関連していないサーバー(同じ秘密鍵を使用する)の特定のOpenStack VMにSSHで接続し、そのサーバーにSSHで接続すると、パスワードの入力を求められます。ところで、鍵にパスワードが設定されていないため、やむを得ず「権限が拒否されました(公開鍵)」というメッセージが表示されます。間違い。

再確認するために、仮想マシンから秘密鍵を削除し、マイscpコンピュータから秘密鍵を再挿入してから同じコマンドを試しましたが、パスワードを入力するように求められます。

言い換えれば:

  1. PC - SSH - Server1 =正常に動作
  2. PC - SSH - Server2 - SSH - Server1 =うまく動作します
  3. PC - SSH - Server2 - SSH - 仮想マシン - SSH - Server1 = パスワードが必要

その理由は何ですか?これは間違いなく私が使用している正しい秘密鍵であり、適切な権限があります。

ssh -v -i .ssh/[my private key] username@domain編集 - 必要に応じて出力

OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /.ssh/[my private key].ppk type -1
debug1: key_load_public: No such file or directory
debug1: identity file /.ssh/[my private key].ppk-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to xxx.xxx.xxx.xxx:22 as '[my username]'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: [email protected] need=64 dh_need=64
debug1: kex: [email protected] need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ZiugTjR5fM0E3evOwHoePFKspDQChA0Ab6L0q88KP/g
debug1: Host 'xxx.xxx.xxx.xxx' is known and matches the ECDSA host key.
debug1: Found key in /home/centos/.ssh/known_hosts:2
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/[my private key].ppk
Enter passphrase for key '/.ssh/[my private key].ppk':
Enter passphrase for key '/.ssh/[my private key].ppk':
Enter passphrase for key '/.ssh/[my private key].ppk':
debug1: No more authentication methods to try.
Permission denied (publickey).

ベストアンサー1

Enter passphrase for key '/.ssh/[my private key].ppk':

「ppk」は使用される拡張子です。パテキー生成ツール。パテツールを使用してキーファイルを生成したようです。残念ながら、OpenSSHsshユーティリティはPuTTYキーファイル形式を読み取ることができません。sshキーファイルを解析できないたびにパスワードを要求するので、パスワードを要求してください。

パテキーツールを使用して、OpenSSH形式でキーをエクスポートできます。 2つのファイルで終わる必要があり、my-private-key..pubmy-private-key.pubファイルにはリモートシステムにインストールされている公開鍵の一部が含まれています。他のファイルには、このコマンドで使用する秘密鍵が含まれていますssh

または、OpenSSHssh-keygenユーティリティを使用して新しいキーを生成することもできます。

おすすめ記事