The stuck is due to the problem of LIUNX security settings. It will be automatically disconnected if no data is used for a period of time. The solution is to let the local or server send a request to the other party every other time.
Open the configuration file locally (not recommended to set on the server side)
sudo vim /etc/ssh/ssh_config
Add the following parameters at the end of the file, and remove the following comments when adding
ServerAliveInterval 50 #每隔50秒就向服务器发送一个请求
ServerAliveCountMax 3 #允许超时的次数,一般都会响应
Restart the ssh service after modification
sudo /etc/init.d/ssh restart