After the terminal of MAC connects with the remote server, it may be disconnected due to no data interaction with the server for a period of time. Now, the following methods can be used to maintain the long-term connection between the terminal and the remote server.
Edit the SSH? Config file:
sudo vi /etc/ssh/ssh_config
Under host *, add:
Finally, use: WQ! To save and exit.
The meaning of this sentence is that every 60s the client sends an empty packet to the server, so that the connection can be maintained.