Mac terminal keeps connection with server


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:

ServerAliveInterval 60 

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.

Mac terminal keeps connection with server

Recommended Today

DK7 switch’s support for string

Before JDK7, switch can only support byte, short, char, int or their corresponding encapsulation classes and enum types. After JDK7, switch supports string type. In the switch statement, the value of the expression cannot be null, otherwise NullPointerException will be thrown at runtime. Null cannot be used in the case clause, otherwise compilation errors will […]