Keep SSH Sessions running after disconnection - for overnight [closed]

喜欢而已 提交于 2019-12-10 17:08:01

问题


This is a follow up question for this question.

I took the advise by @Chris Lear by using screen commend. It works great, for short time sign out. But i met the following question several times.

After I log out, by ctrl+a, ctrl+d, and go to sleep, and try to resume on next morning, I am keep getting the following error message and the matlab progress on server is dead.

The error message is: packet_write_wait: connection to 128.2.xx.xxx: Broken pipe.

any ideas on how to fix this?

Thank you!


回答1:


Run the screen on the server (as opposed to on the client, which is what you seem to be doing right now). This way, MATLAB can write output even if you are not connected to the server via ssh. The order of commands for this is ssh, screen, matlab. If you want to resume your session, just connect to the server via ssh, then run something like screen -x




回答2:


Open /etc/ssh/ssh_config on your (client) computer. Add the following line:

ServerAliveInterval 100
ServerAliveCountMax 3  (default)

You can also set these values at the per-user level in ~/.ssh/config

Just remember this -- if you leave your ssh session open accidentally, anyone else with access to your desktop can get on it. Remember to close your session when finished.



来源:https://stackoverflow.com/questions/33205456/keep-ssh-sessions-running-after-disconnection-for-overnight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!