SSH接続を確立できません。 " debug1: read_passphrase: /dev/tty を開けませんでした: そのファイルやディレクトリはありません。" 「ホストキーの確認に失敗しました。」

SSH接続を確立できません。

リモートサーバーの1つにSSH接続を確立できません。

両方のアドレス、ユーザー名、パスワードがあります。

次のようにSSH接続を作成すると、ssh user@server次のエラーが発生します。Host key verification failed.

このトピックに関する最も一般的な答えはssh-keygen -R hostname。問題は私のリモートサーバーにあります。権限が非常に制限されているため、エラーが発生しますssh-keygen: command is not found。通常、serviceor allなどのコマンドはsu同じエラーを生成しますcommand is not found

SFTPを介してFilezillaへの接続を作成できるので、この問題を手動で修正できますか?また、重要な場合、私の.sshディレクトリは空なので、そこknown_hostには何もありません。

これが完全な出力ですssh -v user@server

OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Connecting to XXX port 22.
debug1: Connection established.
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_rsa-cert type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: identity file /.ssh/id_dsa-cert type -1
debug1: identity file /.ssh/id_ecdsa type -1
debug1: identity file /.ssh/id_ecdsa-cert type -1
debug1: identity file /.ssh/id_ed25519 type -1
debug1: identity file /.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1Debian-5+deb8u4
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u4 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: kex: [email protected] need=20 dh_need=20
debug1: kex: [email protected] need=20 dh_need=20
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA XXX
debug1: read_passphrase: can't open /dev/tty: No such file or directory
Host key verification failed.

私はWindows PCを使用してsshPuTTyを介してリモートサーバー(サーバー1と呼ばれる)に接続しています。サーバー1では、scpおよびデフォルトのシェルコマンドを除くすべてのsshエントリを実行する権限がほとんどありません。このサーバーでは、私はオンラインストアを運営していますが、そのバックアップは他のサーバー(サーバー2と呼びます)で停止する必要があります。

うまくいけばいいのですsftpが、サーバー1には使用できず、インストールすることもできません。だから私はscp。試してみましたが、驚くcurl sftp://xxx.xxxべきことに実際に動作しましたが、まだ新しいエラーが発生しますcurl: (51) SSL peer certificcate or SSH remote key was not ok

ベストアンサー1

このHost key verification failedエラーメッセージは、SSHクライアントがリモートサーバーの受信公開鍵を比較して、ファイルに保存されている~/.ssh/known_hostsホストキーのバージョンと一致しないことを発見しました。

このコマンドはssh-keygen -R hostnameリモートホストで何もしません。特別な権限は必要ありません。このコマンドが実行する操作は、古いホストhostnameキーを削除するだけです。あなたの地域 known_hosts文書。その後、次の接続時にhostnameSSHクライアントに現在のホストキーの指紋が表示され、hostnameそれを受け入れるように求められます。初めてホストに接続するときと同じです。

ただし、使用できるコマンドがない場合は接続を試みることができます。

ssh -o StrictHostKeyChecking=no user@server

StrictHostKeyCheckingこのオプションのデフォルト値は、ask以前に未知のホストキーを受け入れるか拒否するかを示すメッセージです。ただし、セッションに疑似TTYがないため、sshクライアントは非対話モードになっており、メッセージを表示しません。値はnoホストキーを自動的に受け入れる必要があります。可能であれば、sshホストキーが~/.ssh/known_hostsファイルに書き込まれます。成功した場合、-o StrictHostKeyChecking=noこのオプションは特定のサーバーに初めて接続したときにのみ必要です。

おすすめ記事