macos 在 Mac OS 上避免 SSH 超时?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8660532/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:43:36  来源:igfitidea点击:

Avoiding SSH timeouts on Mac OS?

macosssh

提问by Michael Eilers Smith

Every time I connect to a server with ssh, the connection is reset after a few minutes if there is no input. However, I want to remove these timeouts as to keep the connection alive for as long as possible.

每次我使用 ssh 连接到服务器时,如果没有输入,几分钟后连接会重置。但是,我想删除这些超时以尽可能长时间地保持连接活动。

By looking on different forums, I saw it was possible to modify the ServerAliveInterval option in the /etc/ssh_config file. However, there doesn't seem to be this option in my file. Where could it be?

通过查看不同的论坛,我发现可以修改 /etc/ssh_config 文件中的 ServerAliveInterval 选项。但是,我的文件中似乎没有这个选项。它可能在哪里?

I'm running OpenSSH_5.2p1 on Snow Leopard.

我在雪豹上运行 OpenSSH_5.2p1。

Thanks!

谢谢!

回答by Dominic Green

Server Alive interval simply sends a null packet to the server at a set time to keep the connection alive, you should just be able to add some thing like into your config file: ~/.ssh/config

服务器活动间隔只是在设定的时间向服务器发送一个空数据包以保持连接活动,您应该能够在配置文件中添加一些类似的内容: ~/.ssh/config

Host *
 ServerAliveInterval 60

The second line must be indented with at least one space. *will match any host; if you wanted you could restrict this to particular destinations like *somedomain.com.

第二行必须至少缩进一个空格。 *将匹配任何主机;如果您愿意,您可以将其限制为特定目的地,例如 *somedomain.com。

Check out http://kehlet.cx/articles/129.html

查看http://kehlet.cx/articles/129.html