web-dev-qa-db-ja.com

sshfsを使用したピアによる接続リセット

今のところ問題なく動作するFuse/sshfsマウントを使用しています。サーバーシステムを再インストールする必要があり、突然、古典的な_read: Connection reset by peer_エラーが発生しました。公開鍵認証を使用していて、新しくインストールしたシステムに自分の鍵をコピーしました。通常のsshログインは正常に機能します。ログをデバッグに変更しましたが、悲しいことに、これは有用な情報を提供しません。

_sshd[2077]: debug1: Forked child 2198.
sshd[2198]: Set /proc/self/oom_score_adj to 0
sshd[2198]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
sshd[2198]: debug1: inetd sockets after dupping: 3, 3
sshd[2198]: Connection from 192.168.1.6 port 47991
sshd[2198]: debug1: Client protocol version 2.0; client software version OpenSSH_6.1p1 Debian-4
sshd[2198]: debug1: match: OpenSSH_6.1p1 Debian-4 pat OpenSSH*
sshd[2198]: debug1: Enabling compatibility mode for protocol 2.0
sshd[2198]: debug1: Local version string SSH-2.0-OpenSSH_6.1p1 Debian-4
sshd[2198]: debug1: permanently_set_uid: 103/65534 [preauth]
sshd[2198]: debug1: list_hostkey_types: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256 [preauth]
sshd[2198]: debug1: SSH2_MSG_KEXINIT sent [preauth]
sshd[2198]: debug1: SSH2_MSG_KEXINIT received [preauth]
sshd[2198]: debug1: kex: client->server aes128-ctr hmac-md5 none [preauth]
sshd[2198]: debug1: kex: server->client aes128-ctr hmac-md5 none [preauth]
sshd[2198]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
sshd[2198]: debug1: SSH2_MSG_NEWKEYS sent [preauth]
sshd[2198]: debug1: expecting SSH2_MSG_NEWKEYS [preauth]
sshd[2198]: Connection closed by 192.168.1.6 [preauth]
sshd[2198]: debug1: do_cleanup [preauth]
sshd[2198]: debug1: monitor_read_log: child log fd closed
sshd[2198]: debug1: do_cleanup
sshd[2198]: debug1: Killing privsep child 2199
_

誰かが私がここで欠けているものを知っていますか?

[〜#〜]更新[〜#〜]

デバッグレベル3の_auth.log_

_sshd[2455]: debug3: fd 5 is not O_NONBLOCK
sshd[2455]: debug1: Forked child 2456.
sshd[2455]: debug3: send_rexec_state: entering fd = 8 config len 751
sshd[2455]: debug3: ssh_msg_send: type 0
sshd[2455]: debug3: send_rexec_state: done
sshd[2456]: debug3: oom_adjust_restore
sshd[2456]: Set /proc/self/oom_score_adj to 0
sshd[2456]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
sshd[2456]: debug1: inetd sockets after dupping: 3, 3
sshd[2456]: Connection from 192.168.1.6 port 50037
sshd[2456]: debug1: Client protocol version 2.0; client software version OpenSSH_6.1p1 Debian-4
sshd[2456]: debug1: match: OpenSSH_6.1p1 Debian-4 pat OpenSSH*
sshd[2456]: debug1: Enabling compatibility mode for protocol 2.0
sshd[2456]: debug1: Local version string SSH-2.0-OpenSSH_6.1p1 Debian-4
sshd[2456]: debug2: fd 3 setting O_NONBLOCK
sshd[2456]: debug2: Network child is on pid 2457
sshd[2456]: debug3: preauth child monitor started
sshd[2456]: debug3: privsep user:group 103:65534 [preauth]
sshd[2456]: debug1: permanently_set_uid: 103/65534 [preauth]
sshd[2456]: debug1: list_hostkey_types: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256 [preauth]
sshd[2456]: debug1: SSH2_MSG_KEXINIT sent [preauth]
sshd[2456]: debug1: SSH2_MSG_KEXINIT received [preauth]
sshd[2456]: debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 [preauth]
sshd[2456]: debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256 [preauth]
sshd[2456]: debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] [preauth]
sshd[2456]: debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] [preauth]
sshd[2456]: debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 [preauth]
sshd[2456]: debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 [preauth]
sshd[2456]: debug2: kex_parse_kexinit: none,[email protected] [preauth]
sshd[2456]: debug2: kex_parse_kexinit: none,[email protected] [preauth]
sshd[2456]: debug2: kex_parse_kexinit:  [preauth]
sshd[2456]: debug2: kex_parse_kexinit:  [preauth]
sshd[2456]: debug2: kex_parse_kexinit: first_kex_follows 0  [preauth]
sshd[2456]: debug2: kex_parse_kexinit: reserved 0  [preauth]
sshd[2456]: debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 [preauth]
sshd[2456]: debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-rsa,ssh-dss [preauth]
sshd[2456]: debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] [preauth]
sshd[2456]: debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] [preauth]
sshd[2456]: debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 [preauth]
sshd[2456]: debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 [preauth]
sshd[2456]: debug2: kex_parse_kexinit: none,[email protected],zlib [preauth]
sshd[2456]: debug2: kex_parse_kexinit: none,[email protected],zlib [preauth]
sshd[2456]: debug2: kex_parse_kexinit:  [preauth]
sshd[2456]: debug2: kex_parse_kexinit:  [preauth]
sshd[2456]: debug2: kex_parse_kexinit: first_kex_follows 0  [preauth]
sshd[2456]: debug2: kex_parse_kexinit: reserved 0  [preauth]
sshd[2456]: debug2: mac_setup: found hmac-md5 [preauth]
sshd[2456]: debug1: kex: client->server aes128-ctr hmac-md5 none [preauth]
sshd[2456]: debug2: mac_setup: found hmac-md5 [preauth]
sshd[2456]: debug1: kex: server->client aes128-ctr hmac-md5 none [preauth]
sshd[2456]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
sshd[2456]: debug3: mm_key_sign entering [preauth]
sshd[2456]: debug3: mm_request_send entering: type 5 [preauth]
sshd[2456]: debug3: mm_key_sign: waiting for MONITOR_ANS_SIGN [preauth]
sshd[2456]: debug3: mm_request_receive_expect entering: type 6 [preauth]
sshd[2456]: debug3: mm_request_receive entering [preauth]
sshd[2456]: debug3: mm_request_receive entering
sshd[2456]: debug3: monitor_read: checking request 5
sshd[2456]: debug3: mm_answer_sign
sshd[2456]: debug3: mm_answer_sign: signature 0x7f9b687c7680(100)
sshd[2456]: debug3: mm_request_send entering: type 6
sshd[2456]: debug2: monitor_read: 5 used once, disabling now
sshd[2456]: debug2: kex_derive_keys [preauth]
sshd[2456]: debug2: set_newkeys: mode 1 [preauth]
sshd[2456]: debug1: SSH2_MSG_NEWKEYS sent [preauth]
sshd[2456]: debug1: expecting SSH2_MSG_NEWKEYS [preauth]
sshd[2456]: Connection closed by 192.168.1.6 [preauth]
sshd[2456]: debug1: do_cleanup [preauth]
sshd[2456]: debug3: PAM: sshpam_thread_cleanup entering [preauth]
sshd[2456]: debug1: monitor_read_log: child log fd closed
sshd[2456]: debug3: mm_request_receive entering
sshd[2456]: debug1: do_cleanup
sshd[2456]: debug3: PAM: sshpam_thread_cleanup entering
sshd[2456]: debug1: Killing privsep child 2457
_

[〜#〜]更新[〜#〜]

手動でsshfsマウントを試しましたが、_read: Connection reset by peer_も取得しました。次に、デバッグオプションを追加し、Permission denied (publickey).も取得しました。公開鍵が設定されていて、それ以外の場合は正常に機能するため、これは奇妙です。また、ユーザーをssh接続に使用し、秘密鍵ファイルを手動で指定しています。これは、ルートアカウントがサーバーのどこかで正しい公開鍵にアクセスできないという問題の可能性がありますか?私は実行しています

_Sudo sshfs myuser@myserver:/mnt/foo /mnt/foo -o IdentityFile=/home/myuser/.ssh/id_rsa
_

関連するログ部分は

_debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/myuser/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
read: Connection reset by peer
_
34
André Stannek

何度も試してみたところ、クライアントユーザーがFuseグループに含まれていないことがわかりました。 Sudo usermod -a -G Fuse myuserで追加した後、マウントは再び正常に機能します。サーバーを再インストールする前に、それがどのように機能したかを尋ねないでください。ご協力ありがとうございます!

17
André Stannek

-F /path/to/configオプション。答えは私の設定ファイルにありました

IdentityFile ~/.ssh/id_rsa

うまくいきませんでした。絶対パスが必要です:

IdentityFile /home/user/.ssh/id_rsa
24

このエラーメッセージはssh接続が失敗した場合のデフォルトメッセージであるため、(@ peterphコメントごとの)最も一般的な答えは、少なくとも-odebugを使用して調査することです。

sshfs -odebug,sshfs_debug,loglevel=debug ...

例えば

sshfs -odebug,sshfs_debug,loglevel=debug -o Ciphers=arcfour -o Compression=no -o allow_root -o transform_symlinks localhost:/ /mnt/your_mount_point

他の場所で述べたように、一般的な原因には、allow_otherFuse.confの欠落、またはFuseグループメンバーシップの欠落が含まれます(ただし、Ubuntu 18.04では不要になる可能性があります)。

私の場合、これは印刷されました:

SSHFS version 2.8 Fuse library version: 2.9.7 nullpath_ok: 0 nopath: 0 utime_omit_ok: 0 executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-ologlevel=debug> <-oIdentityFile=~/.ssh/id_rsa> <-oCiphers=arcfour> <-oCompression=no> <-2> <localhost> <-s> <sftp> command-line line 0: Bad SSH2 cipher spec 'arcfour'. read: Connection reset by peer

...サポートされていない暗号オプションを指している(Fedoraでは機能するが、ubuntuでは機能しない)

13
eddygeek

今日も同じ問題がありました。 ssh接続は問題ありませんが、sshfsは問題です。私のSSHサーバーはQnap NAS(TS-228)です。

この問題はSFTPを有効にする NASデバイスで修正されました。

追加設定がsshd_configに登場:

Subsystem sftp /usr/libexec/sftp-server
8
Geom

同様の問題が、次のFuse構成ファイルに関係していることがわかりました。

/etc/Fuse.conf

コメントを外す必要がありました:

user_allow_other
5
cennings

誰かがこのスレッドにつまずいた場合に備えて、私はこれをread: Connection reset by peerホスト名によるエラー解決できませんでした(完全修飾ホストを使用していませんでした)。適切なホスト名を使用することで問題は解決しました-エラーメッセージは完全に誤解を招くだけです。

適切なテストは、sshfsコマンドを実行する前にマシンにsshを実行することです。それでも機能しない場合は、sshfsも機能しません。

5
Bob Lauer

私はこのエラーを受け取り、上記の方法を試してみましたが、うまくいきませんでした。

問題は、サーバーがポート22でsshを受け入れていなかったことでした。

$sshfs -p 2222 user@server:/path/to/folder ~/local/path

そしてそれは問題を解決しました。

2
Arashr

Sudo sshfs [...] myhost: /mnt/myhostの実行中に同じエラーが発生しました。myhost~/.ssh/configファイルで定義されています。

問題は、Sudo sshfsを実行すると、私のホームディレクトリで~/.ssh/configが検索されず、rootsが検索されることです。解決策は、-Fを介して構成ファイルを明示的に渡すことでした:

Sudo sshfs -F /home/dandv/.ssh/config [...] myhost: /mnt/myhost
2
Dan Dascalescu

私のエラーはサーバーサイドでした。 sshdのsftpサブシステムは、デフォルトでは新しいcentos 7.6.xxでは使用できないようになっています。/etc/ssh/sshd_configの次の前から「#」を削除することで修正

Subsystem sftp /usr/libexec/openssh/sftp-server

この問題を見つけるのに役立つ-odebugレシピのeddygeekに感謝します。上記のGEOMと同じですが、Qnapに固有ではありません。

2
J.Bravo

veryの簡単な解決策を探している人のために:デバッグモードでsshfsを実行した後、接続が切断されていることがわかりました。

スイッチで詳細モードをオンにします。

-o debug
1
sandoval31

私の場合、起動時に長い時間が経過してもサーバーインターフェイスが起動していませんでした。サーバーは、トランクモードでCiscoスイッチポートに接続されています。トランクポートは実際にUP(通常30秒以上)になる前にさまざまなチェックを行うため、上記の接続リセットエラーメッセージが表示されます。

私の解決策は、spanning-tree portfastを使用してスイッチポートをアクセスモードに変更することでした。私の環境では、このサーバーにトランクモードは必要ないためです。

また、sshfsのデバッグパラメータを使用して、この問題を発見しました。

1
afardana

同様の問題があり、ネットワーク構成を確認したところ、ゲートウェイアドレスが失われたことがありました。だから私は以下のコマンドを実行しました

route add default gw 1​​92.169.0.254

その後、システムを再起動しました。

再起動後に問題は解決しました。

1
Jag

/home/user/.ssh/known_hostsからホストのフィンガープリントを消去し(実際にはファイル全体を削除しました)、フィンガープリントが変更されていたため、修正しました... sshを使用してホストに接続すると、接続されなかった理由が明確になりました。

1
mdxe

誰かがまだ問題を抱えていて、私のようなバカである場合は、Sudoを使用して(ローカルシステムに)新しいディレクトリを作成していないことを確認してください。

そのため、あなた(ローカルユーザー)は書き込み権限を持っていません。

これにより、マウントポイントとして使用できなくなります。

これのクイックフィックスはSudo chown -R localuser:localuser ~/directory_you_created

(実際のユーザー名でlocaluserを置き換えます)。

乾杯。

0
rand0m9