Auto Disconnect problem when SSH connects to remote server under Mac

Source: Internet
Author: User

SSH is automatically disconnected when you use SECURECRT to connect to a remote server via SSH on a Mac, and there is always a time when there is no action. Using Xmanager under Windows doesn't seem to have encountered this problem.

Find a solution on the internet as follows:
Client Configuration:
The Global.ini file will D: "Disconnect after resume timeout" = 00000000 to D: "Disconnect after resume timeout" =ffffffff
SECURECRT interface configuration: send string \ Every seconds or send protocol no-op every
Server-side configuration:
Configuration tmout=0 in the/etc/profile file
However, in the SECURECRT test found invalid, possible reasons are: multi-person response SecureCRT Mac version has this problem, Mac WiFi disconnect caused (WiFi disconnect for a variety of reasons, such as leaving the WiFi area, Mac hibernation automatically disconnect WiFi, etc.).

Search on the Internet, Mac popular SSH tools, there are securecrt, Iterm2, Telnet Lite, and so on, down to try, ITERM2 interface and experience the best, so decided to abandon SecureCRT, instead of Iterm2.
The problem of automatic disconnection of SSH is still found in Iterm2, so a long process of searching and testing is started.
Some of the solutions available online are:
Add the following in the client: ~/.ssh/config file (if not new):
Host *
Serveraliveinterval 60
This means that every 60s is sent once to keep the connection.
Note: In the SSH client, do not change on the server (Clientaliveinterval, Clientalivecountmax 100), unsafe


This method is used to test the ITERM2 and the own terminal.
1. Server settings tmout=0, client settings Serveraliveinterval 60, will not be broken
Server-side settings tmout=900, client settings Serveraliveinterval 60,900s immediately after the break, and a prompt to disconnect
2. Server Set tmout=0, the client does not serveraliveinterval 60, half an hour after the terminal did not respond, and did not prompt disconnection
Server Set tmout=900, the client does not serveraliveinterval 60, half an hour after the terminal did not respond, and did not prompt to disconnect

So the Final Solution:
1. Use your own terminal or ITERM2,ITERM2 interface and user experience a little better
2. Server:/etc/profile file in the configuration Tmout=0,source/etc/profile effective, re-login user
3. Client: Config in ~/.ssh/config file
Host *
Serveraliveinterval 60

Reference:
Https://ztgame.shenyu.me/linux/ssh-config.html
Http://bluebiu.com/blog/iterm2-ssh-session-idle.html
Http://bluebiu.com/blog/linux-ssh-session-alive.html

Auto Disconnect problem when SSH connects to remote server under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.