1. PuTTY的Connection项目中设定"Sending of null packets to keep session active",也就是每隔几秒传送一个null packet让session不会timeout.

2.启用sshd host的/etc/ssh/sshd_config设定值:TCPKeepAlive yes.