博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ssh客户端会话_如何保持Linux SSH会话不断开连接-服务器和客户端修复
阅读量:2519 次
发布时间:2019-05-11

本文共 2078 字,大约阅读时间需要 6 分钟。

ssh客户端会话

is a very common tool for /Unix platforms. One annoying problem when using SSH is that the connection may get disconnected if the SSH connection is idle for some time under common configurations. Users may run an infinite loop like while true; do uptime; sleep 30; done when there is no work to be done in a SSH session. There are better ways as SSH servers and clients already provide such support and we will discuss these methods in this post.

是 / Unix平台上非常常用的工具。 使用SSH时的一个烦人的问题是,如果在常规配置下SSH连接空闲一段时间,则连接可能会断开连接。 用户可能会像while true; do uptime; sleep 30; done那样运行无限循环while true; do uptime; sleep 30; done while true; do uptime; sleep 30; done while true; do uptime; sleep 30; done的时候没有一个SSH会话工作要做。 有更好的方法,因为SSH服务器和客户端已经提供了这种支持,我们将在本文中讨论这些方法。

客户端修复–每个用户 (Client side fixes – per user )

The pro is that users can configure the ssh client by themselves. The con is that every user will need to do it.

优点是用户可以自己配置ssh客户端。 缺点是每个用户都需要这样做。

Linux SSH客户端 (Linux ssh client )

Option 1: Add to your ~/.ssh/config

选项1:添加到您的〜/ .ssh / config

# Client will send "keep alive" messages every 60 seconds # for all server hostsHost *    ServerAliveInterval 60

Option 2: Add as a command option

选项2:添加为命令选项

$ ssh -o "ServerAliveInterval 60" example.com

( )

In the Connection category for a session, fill 60 in “Sending of null packets to keep session alive”.

在会话的“连接”类别中,在“发送空数据包以保持会话有效”中填写60。

putty-keep-alive.png

客户端修复–系统范围内的 (Client side fixes – system wide )

The above methods can also be applied for all users on the system.

以上方法也可以应用于系统上的所有用户。

Add to /etc/ssh/ssh_config

添加到/ etc / ssh / ssh_config

# Client will send "keep alive" messages every 60 secondsServerAliveInterval 60

服务器端修复–系统范围内的 (Server side fixes – system wide )

The SSH server can be configured to send keep alive messages to avoid idle session being got disconnected so that users will not need any special configurations.

可以将SSH服务器配置为发送保持活动消息,以避免断开空闲会话,从而使用户不需要任何特殊配置。

Add to /etc/ssh/sshd_config

添加到/ etc / ssh / sshd_config

# Server will send "keep alive" messages every 60 secondsClientAliveInterval 298

References:

参考文献:

翻译自:

ssh客户端会话

转载地址:http://lmlwd.baihongyu.com/

你可能感兴趣的文章
数据访问-----ADO.NET 小结和练习
查看>>
Linux lsof详解
查看>>
子组件给父组件传数据
查看>>
unix/linux下的共享内存、信号量、队列信息管理
查看>>
Hilbert先生旅馆的故事
查看>>
采访吴岳师兄有感 by 王宇飞
查看>>
LVS简略介绍
查看>>
hdu 1021 Fibonacci Again
查看>>
JVM架构_XmnXmsXmxXss有什么区别:转
查看>>
PHPExcel 使用心得
查看>>
洛谷 P3374 【模板】树状数组 1(单点加,区间和)
查看>>
verilog 代码编写小记
查看>>
PyQT的安装和配置
查看>>
从 docker 到 runC
查看>>
守护进程
查看>>
php数组
查看>>
Linux 防火墙
查看>>
互联网金融P2P主业务场景自动化测试
查看>>
My third day of OpenCV
查看>>
Android的View和ViewGroup分析
查看>>