Keep SSH Sessions running after disconnection - fo

2019-07-07 08:29发布

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!

2条回答
可以哭但决不认输i
2楼-- · 2019-07-07 08:34

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

查看更多
我命由我不由天
3楼-- · 2019-07-07 08:34

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.

查看更多
登录 后发表回答