[自己解決]macOS Mojave 10.14.1にするとSSHが不安定になった。
macOS Mojave 10.14.1を適用してからいつもどおりにSSHが使えなくなっていました。
外出先のWi-FiやiPhoneのテザリングに接続した状態でSSHを使用すると問題ないのですが、自宅のWi-Fiに接続するとSSHが使えません。
-vvvオプションを使用してみると以下のログで止まっていました。
~省略~
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 5 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x48
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
packet_write_wait: Connection to ***.***.***.*** port 22: Broken pipe
ネットワークを疑ったりとMacBookを疑って普通の初期化をしましたが効果はありませんでした。
いろいろ調べたところ、-o ProxyCommand='nc %h %p'というSSHコマンドオプションを追加すると一時的に解決できることがわかりました。
前まではこんなコマンドを追加しなくてもSSHを使用できていたので、原因を特定するべく、次にmacOSの復元を試しました。
Mac起動時にshift + option ⌘ + Rを押して前のバージョンへ戻すやり方でやりました。
自分のモデルの場合はmacOS High Sierra 10.13.6まで戻り、すぐさまSSHを使ってみると今までどおりのSSHに戻ることができました。
恐らくmacOSのアップデートが原因ではないかと思っています。
macOS Mojave 10.14.1のままSSHを使用するにはSSHコマンドオプションに-o ProxyCommand='nc %h %p'を使用すると接続できるかと思います。
同じ状況の方がいればぜひ試してみてください!
MacBook Pro (15-inch, 2018), macOS Mojave (10.14.1), null