用Windows powershell ssh連接VirtualBox的Ubuntu虛擬機,一開始可以成功,一段時間後會報錯virtualbox client_loop: send disconnect: Connection reset
並退出,想再次登錄時會報ssh: connect to host 192.168.1.111 port 22: Connection refused
的錯誤
根據這裏的說法可以添加延長連接超時的配置
$ sudo vim /etc/ssh/sshd_config
# Added the following:
# ClientAliveInterval 60
# ClientAliveCountMax 5
不過我發現我的情況還和Terminal Session有關,就算添加配置並重啓VM後,如果不關閉當前的Terminal Session (不管是powershell本身的應用,還是VSCode裏的Terminal窗口),都還是會報拒絕連接的錯,但是新開一個窗口就好了