RAK部落:解决SSH连接Linux超时自动断开的方法详解

RAK部落小编记得之前在使用Linux服务器时SSH连接不会自动断开,但是由于后期公司更改网段后,连接Linux服务器后过一段时间就会自己断开,这就让小编很纳闷,后来凭借个人的经验,试了一下果然可以,具体操作就随RAK部落小编一起往下看把。

1、$TMOUT 系统环境变量

# 用以下命令判断是否是否设置了该参数 echo $TMOUT
# 如果输出空或0表示不超时,大于0的数字n表示n秒没有收入则超时
# 修改方法 vi /etc/profile
# —————————- export TMOUT=900
# —————————-
# 将以上900修改为0就是设置不超时 source /etc/profile
# 让配置立即生效

RAK部落:解决SSH连接Linux超时自动断开的方法详解

2、sshd 服务配置

cd /etc/ssh
# 查看sshd_config中关于客户端活动状态的配置 grep ClientAlive sshd_config # 默认配置如下
# —————————-
#ClientAliveInterval 0 #ClientAliveCountMax 3
# —————————-
# ClientAliveInterval指定了服务器端向客户端请求消息的时间间隔, 默认是0, 不发送。设置60表示每分钟发送一次, 然后客户端响应, 这样就保持长连接了。
# ClientAliveCountMax表示服务器发出请求后客户端没有响应的次数达到一定值, 就自动断开。正常情况下, 客户端不会不响应,使用默认值3即可。
# 备份原配置文件 cp sshd_config sshd_config.bak
# 启用客户端活动检查,每60秒检查一次,3次不活动断开连接 sed -i “s/
#ClientAliveInterval 0/ClientAliveInterval 60/g” sshd_config sed -i “s/
#ClientAliveCountMax 3/ClientAliveCountMax 3/g” sshd_config
# 确认修改 grep ClientAlive sshd_config
# 比较配置文件差异 diff sshd_config sshd_config.bak
# 重新加载ssd配置,让配置生效 service sshd reload

最后让配置生效即可完全解决解决SSH连接Linux超时自动断开的问题,RAK部落凭借个人的经验编写完成,这篇文章有没有帮到你呢?如果在操作过程中有任何问题请下方评论,小编看到会第一时间处理。

此文章来自固定链接:http://www.rakbuluo.com/p115

原文链接:,转发请注明来源!

发表评论

  • 81 Responses to “RAK部落:解决SSH连接Linux超时自动断开的方法详解”
    • mexican online pharmacies

      <a href="http://canadianpharmacyhopemeds.com/">canadian drug stores</a>
      http://canadianpharmacyhopemeds.com/
      <a href=http://canadianpharmacyhopemeds.com/>legitimate canadian mail order pharmacies</a>

      回复
    • mexican pharmacies

      <a href="http://canadianpharmacyhopemeds.com/">canadian online pharmacy no prescription</a>
      http://canadianpharmacyhopemeds.com/
      <a href=http://canadianpharmacyhopemeds.com/>canadian pharmacy reviews</a>

      回复
    • highest rated canadian pharmacies

      <a href="http://canadianonlinepharmacykkr.com/">reputable canadian online pharmacies</a>
      http://canadianonlinepharmacykkr.com/
      <a href=http://canadianonlinepharmacykkr.com/>aarp recommended canadian online pharmacies</a>

      回复
    • best online pharmacies

      <a href="http://canadianonlinepharmacykkr.com/">pharmacy online</a>
      http://canadianonlinepharmacykkr.com/
      <a href=http://canadianonlinepharmacykkr.com/>international pharmacy</a>

      回复
    • overseas pharmacies shipping to usa

      <a href="http://canadianbestpharmacyonline.com/">legitimate online pharmacies</a>
      http://canadianbestpharmacyonline.com/
      <a href=http://canadianbestpharmacyonline.com/>canadian pharmaceuticals online safe</a>

      回复
    • mexican pharmacies

      <a href="http://canadianbestpharmacyonline.com/">list of approved canadian pharmacies</a>
      http://canadianbestpharmacyonline.com/
      <a href=http://canadianbestpharmacyonline.com/>overseas pharmacies online</a>

      回复
    • Abqdzob

      se tomar viagra diariamente does drinking alcohol raise blood pressure viagra ft skillz pimpex lyrics <a href="https://viawithoutdctrs.com/#">viagra prescription</a> - medications avoid cialis https://viawithoutdctrs.com/# - cialis online mexico dr link

      回复
    • Uhwtuht

      how to stop joint damage with rhumatoid arthritis cialis pill look like
      <a href="https://withoutshort.com">viagra</a> Ujvimtd
      https://withoutshort.com viagra men

      回复
    • NDwene

      <a href=http://www.sansordonnancemd.com>generic viagra</a> http://www.ycialisy.com

      回复
    • Jraidssut

      natural supplements for erectile dysfunction <a href=https://www.withoutbro.com>viagra without a doctor prescription</a> erectile dysfunction restoration centers.com
      sildenafil does it work: https://www.withoutbro.com viagra prescription

      回复
    • Etjkvek

      buy cheap genuine cialis sudden increase in blood pressure cialis combinations <a href="https://tadalafilkiva.com/#">tadalafil 20 mg</a> - difference between cialis cialis soft tabs https://tadalafilkiva.com/# - do need prescription buy cialis information on stds and symptoms

      回复
    • approved canadian pharmacies online

      <a href="http://canadianpharmacyhub.com/">online pharmacy</a>
      http://canadianpharmacyhub.com/
      <a href=http://canadianpharmacyhub.com/>canada drugs online review</a>

      回复
    • EDwene

      <a href=http://www.canadianvolk.com>viagra without a doctor prescription</a> http://www.tadalafilrembo.com

      回复
    • canadian internet pharmacy

      <a href="http://canadianpharmacyhub.com/">list of approved canadian pharmacies</a>
      http://canadianpharmacyhub.com/
      <a href=http://canadianpharmacyhub.com/>top rated canadian pharmacies online</a>

      回复
    • canada pharmacy online

      <a href="http://canadianpharmacyguru.com/">online pharmacy canada</a>
      http://canadianpharmacyguru.com/
      <a href=http://canadianpharmacyguru.com/>list of legitimate canadian pharmacies</a>

      回复
    • canadian online pharmacy reviews

      <a href="http://canadianpharmacyguru.com/">online pharmacies</a>
      http://canadianpharmacyguru.com/
      <a href=http://canadianpharmacyguru.com/>legitimate online pharmacies</a>

      回复
    • Jamburce

      Thanks. Valuable stuff! <a href=https://www.kamagramama.com>kamagra uk</a> kamagra 100
      100 genuine kamagra: https://www.kamagramama.com kamagra

      回复
    • online pharmacies canada

      <a href="http://canadianpharmacyfit.com/">reliable canadian pharmacy</a>
      http://canadianpharmacyfit.com/
      <a href=http://canadianpharmacyfit.com/>canadian pharmacy online</a>

      回复
    • mexican pharmacy online

      <a href="http://canadianpharmacyfit.com/">canada drugs</a>
      http://canadianpharmacyfit.com/
      <a href=http://canadianpharmacyfit.com/>legitimate online pharmacies</a>

      回复
    • reputable canadian online pharmacies

      <a href="http://canadianpharmacycenterhd.com/">certified canadian online pharmacies</a>
      http://canadianpharmacycenterhd.com/
      <a href=http://canadianpharmacycenterhd.com/>legitimate canadian pharmacies online</a>

      回复
    • canada online pharmacies

      <a href="http://canadianpharmacycenterhd.com/">best canadian mail order pharmacies</a>
      http://canadianpharmacycenterhd.com/
      <a href=http://canadianpharmacycenterhd.com/>online canadian pharmacy</a>

      回复
    • canada pharmacy online

      <a href="http://canadianpharmacyhub.com/">most trusted canadian pharmacy</a>
      http://canadianpharmacyhub.com/
      <a href=http://canadianpharmacyhub.com/>canada pharmaceuticals online</a>

      回复
    • mexican border pharmacies

      <a href="http://canadianpharmaciespreshd.com/">canada pharmacy</a>
      http://canadianpharmaciespreshd.com/
      <a href=http://canadianpharmaciespreshd.com/>canadian pharmacy online</a>

      回复
    • canada drug

      <a href="http://canadianpharmaciespreshd.com/">canada online pharmacy</a>
      http://canadianpharmaciespreshd.com/
      <a href=http://canadianpharmaciespreshd.com/>online pharmacies of canada</a>

      回复
    • canadian pharmacies without an rx

      <a href="http://canadianpharmacyguru.com/">legitimate online pharmacies</a>
      http://canadianpharmacyguru.com/
      <a href=http://canadianpharmacyguru.com/>best canadian online pharmacies</a>

      回复
    • mexican pharmacies shipping to usa

      <a href="http://canadianpharmacyfit.com/">canada pharmacy online</a>
      http://canadianpharmacyfit.com/
      <a href=http://canadianpharmacyfit.com/>aarp recommended canadian pharmacies</a>

      回复
    • online pharmacies of canada

      <a href="http://canadianpharmacieshq.com/">canadian pharmaceuticals online reviews</a>
      http://canadianpharmacieshq.com/
      <a href=http://canadianpharmacieshq.com/>canadian drugs</a>

      回复
    • canadian pharmacies online

      <a href="http://canadianpharmacieshq.com/">highest rated canadian pharmacies</a>
      http://canadianpharmacieshq.com/
      <a href=http://canadianpharmacieshq.com/>canada pharmacies online prescriptions</a>

      回复
    • canada pharmaceuticals online

      <a href="http://canadianpharmacycenterhd.com/">online pharmacy reviews</a>
      http://canadianpharmacycenterhd.com/
      <a href=http://canadianpharmacycenterhd.com/>top 10 online pharmacies</a>

      回复
    • safe canadian pharmacies online

      <a href="http://canadianpharmaciesdepot.com/">top 10 online pharmacies</a>
      http://canadianpharmaciesdepot.com/
      <a href=http://canadianpharmaciesdepot.com/>overseas pharmacies shipping to usa</a>

      回复
    • canada pharmaceuticals online

      <a href="http://canadianpharmaciesdepot.com/">legitimate canadian pharmacy online</a>
      http://canadianpharmaciesdepot.com/
      <a href=http://canadianpharmaciesdepot.com/>international pharmacies that ship to the usa</a>

      回复
    • overseas pharmacies

      <a href="http://canadianpharmaciespreshd.com/">top rated canadian pharmacies online</a>
      http://canadianpharmaciespreshd.com/
      <a href=http://canadianpharmaciespreshd.com/>canadian pharmacies shipping to usa</a>

      回复
    • canadian pharmaceuticals online reviews

      <a href="http://canadianfastpharmacy.com/">best canadian pharmacies</a>
      http://canadianfastpharmacy.com/
      <a href=http://canadianfastpharmacy.com/>pharmacy online</a>

      回复
    • overseas online pharmacy

      <a href="http://canadianfastpharmacy.com/">canadian online pharmacy no prescription</a>
      http://canadianfastpharmacy.com/
      <a href=http://canadianfastpharmacy.com/>canadian pharmacies shipping to usa</a>

      回复
    • legitimate canadian pharmacy online

      <a href="http://canadianpharmacieshq.com/">mexican online pharmacies</a>
      http://canadianpharmacieshq.com/
      <a href=http://canadianpharmacieshq.com/>mexican online pharmacies</a>

      回复
    • mexican pharmacy

      <a href="http://canadianpharmacynethd.com/">canadian pharmacies online</a>
      http://canadianpharmacynethd.com/
      <a href=http://canadianpharmacynethd.com/>aarp recommended canadian pharmacies</a>

      回复
    • overseas online pharmacy

      <a href="http://canadianpharmacynethd.com/">canadian trust pharmacy</a>
      http://canadianpharmacynethd.com/
      <a href=http://canadianpharmacynethd.com/>canadian pharmacy</a>

      回复
    • best online canadian pharmacy

      <a href="http://canadianpharmaciesdepot.com/">most reliable canadian pharmacies</a>
      http://canadianpharmaciesdepot.com/
      <a href=http://canadianpharmaciesdepot.com/>best 10 online pharmacies</a>

      回复
    • Iamburce

      Thanks. An abundance of material. <a href=https://www.kamagradr.com>kamagra</a> kamagra pille wirkung
      kamagra oral jelly safe: https://www.kamagradr.com kamagra

      回复
    • reputable mexican pharmacies online

      <a href="http://canadianfastpharmacy.com/">best canadian pharcharmy online</a>
      http://canadianfastpharmacy.com/
      <a href=http://canadianfastpharmacy.com/>best canadian pharmacies</a>

      回复
    • canada drug

      <a href="http://canadiannextpharmacy.com/">best canadian pharcharmy online</a>
      http://canadiannextpharmacy.com/
      <a href=http://canadiannextpharmacy.com/>trust online pharmacy</a>

      回复
    • canada pharmaceuticals online

      <a href="http://canadiannextpharmacy.com/">canadian pharmacy reviews</a>
      http://canadiannextpharmacy.com/
      <a href=http://canadiannextpharmacy.com/>mexican online pharmacies</a>

      回复
    • safe canadian internet pharmacies

      <a href="http://canadianpharmacynethd.com/">legitimate online pharmacies india</a>
      http://canadianpharmacynethd.com/
      <a href=http://canadianpharmacynethd.com/>reliable mexican pharmacies</a>

      回复
    • mail order prescription drugs from canada

      <a href="http://canadianpharmacieselite.com/">approved canadian pharmacies online</a>
      http://canadianpharmacieselite.com/
      <a href=http://canadianpharmacieselite.com/>top rated canadian online pharmacy</a>

      回复
    • canada drug pharmacy

      <a href="http://canadiannextpharmacy.com/">trust pharmacy canada</a>
      http://canadiannextpharmacy.com/
      <a href=http://canadiannextpharmacy.com/>canadian online pharmacy</a>

      回复
    • canadian pharmacies mail order

      <a href="http://canadianonlinepharmacynote.com/">trust online pharmacy</a>
      http://canadianonlinepharmacynote.com/
      <a href=http://canadianonlinepharmacynote.com/>mexican pharmacies online</a>

      回复
    • best canadian pharcharmy online

      <a href="http://canadianonlinepharmacynote.com/">safe canadian pharmacies online</a>
      http://canadianonlinepharmacynote.com/
      <a href=http://canadianonlinepharmacynote.com/>overseas online pharmacies</a>

      回复
    • canadian online pharmacies ratings

      <a href="http://canadianpharmacieselite.com/">overseas pharmacy</a>
      http://canadianpharmacieselite.com/
      <a href=http://canadianpharmacieselite.com/>canadian online pharmacies legitimate</a>

      回复
    • CharlesHob

      tindr , tinder app
      <a href=http://tinderdatingsiteus.com/?>how to use tinder </a>

      回复
    • top canadian pharmacies

      <a href="http://canadianonlinepharmacynote.com/">canadian online pharmacies</a>
      http://canadianonlinepharmacynote.com/
      <a href=http://canadianonlinepharmacynote.com/>legitimate canadian pharmacy</a>

      回复
    • best canadian pharmacies

      <a href="http://canadianpharmacyhopemeds.com/">best 10 online pharmacies</a>
      http://canadianpharmacyhopemeds.com/
      <a href=http://canadianpharmacyhopemeds.com/>overseas pharmacies shipping to usa</a>

      回复
    • canadian drug stores

      <a href="http://canadianpharmacyhopemeds.com/">canadian mail order pharmacies</a>
      http://canadianpharmacyhopemeds.com/
      <a href=http://canadianpharmacyhopemeds.com/>top 10 online pharmacies</a>

      回复
    • most reliable canadian pharmacies

      <a href="http://canadianonlinepharmacykkr.com/">most reliable canadian pharmacies</a>
      http://canadianonlinepharmacykkr.com/
      <a href=http://canadianonlinepharmacykkr.com/>list of safe online pharmacies</a>

      回复
    • my canadian pharmacy

      <a href="http://canadianonlinepharmacykkr.com/">canadian pharmacies</a>
      http://canadianonlinepharmacykkr.com/
      <a href=http://canadianonlinepharmacykkr.com/>best 10 online canadian pharmacies</a>

      回复
    • legitimate online pharmacies

      <a href="http://canadianonlinepharmacykkr.com/">mexican pharmacies shipping to usa</a>
      http://canadianonlinepharmacykkr.com/
      <a href=http://canadianonlinepharmacykkr.com/>online pharmacies canada</a>

      回复
    • legitimate online pharmacies

      <a href="http://canadianbestpharmacyonline.com/">mexican pharmacies online</a>
      http://canadianbestpharmacyonline.com/
      <a href=http://canadianbestpharmacyonline.com/>canadian drugs</a>

      回复
    • best online canadian pharmacy

      <a href="http://canadianbestpharmacyonline.com/">most trusted canadian online pharmacies</a>
      http://canadianbestpharmacyonline.com/
      <a href=http://canadianbestpharmacyonline.com/>international pharmacies that ship to the usa</a>

      回复
    • discount canadian drugs

      <a href="http://canadianbestpharmacyonline.com/">online pharmacies canada</a>
      http://canadianbestpharmacyonline.com/
      <a href=http://canadianbestpharmacyonline.com/>reputable canadian online pharmacies</a>

      回复
    • online pharmacies of canada

      <a href="http://canadianpharmacyhub.com/">list of legitimate canadian pharmacies</a>
      http://canadianpharmacyhub.com/
      <a href=http://canadianpharmacyhub.com/>canadian pharmacies</a>

      回复
    • canadian pharmacies online

      <a href="http://canadianpharmacyhub.com/">canadian trust pharmacy</a>
      http://canadianpharmacyhub.com/
      <a href=http://canadianpharmacyhub.com/>canada pharmaceuticals online</a>

      回复
    • canadian pharmacies online reviews

      <a href="http://canadianpharmacyguru.com/">approved canadian online pharmacies</a>
      http://canadianpharmacyguru.com/
      <a href=http://canadianpharmacyguru.com/>best canadian pharmacies</a>

      回复
    • mexican pharmacies shipping to usa

      <a href="http://canadianpharmacyguru.com/">mexican pharmacy online</a>
      http://canadianpharmacyguru.com/
      <a href=http://canadianpharmacyguru.com/>top 10 online pharmacies</a>

      回复
    • canada pharmaceuticals online

      <a href="http://canadianpharmacyfit.com/">reputable online pharmacy</a>
      http://canadianpharmacyfit.com/
      <a href=http://canadianpharmacyfit.com/>list of reputable canadian pharmacies</a>

      回复
    • canada drug pharmacy

      <a href="http://canadianpharmacyfit.com/">best mexican online pharmacies</a>
      http://canadianpharmacyfit.com/
      <a href=http://canadianpharmacyfit.com/>best online pharmacy</a>

      回复
    • IExcuppy

      health care plans obamacare - <a href="https://www.withoutbro.com">generic cialis</a> Uqmulot
      cialis soft difference
      where to find viagra in india: <a href="https://www.withoutbro.com/">generic viagra</a>

      回复
    • canada drug pharmacy

      <a href="http://canadianpharmacieshq.com/">canada pharmacy</a>
      http://canadianpharmacieshq.com/
      <a href=http://canadianpharmacieshq.com/>canada drugs online review</a>

      回复
    • pharmacy drugstore online

      <a href="http://canadianpharmacycenterhd.com/">canadian pharmaceuticals online safe</a>
      http://canadianpharmacycenterhd.com/
      <a href=http://canadianpharmacycenterhd.com/>canadian pharmacies that ship to us</a>

      回复
    • online pharmacy

      <a href="http://canadianpharmaciespreshd.com/">best online canadian pharmacy</a>
      http://canadianpharmaciespreshd.com/
      <a href=http://canadianpharmaciespreshd.com/>most reliable canadian pharmacies</a>

      回复
    • canadian pharmacies mail order

      <a href="http://canadianpharmaciesdepot.com/">trust online pharmacy</a>
      http://canadianpharmaciesdepot.com/
      <a href=http://canadianpharmaciesdepot.com/>reliable mexican pharmacies</a>

      回复
    • highest rated canadian pharmacies

      <a href="http://canadianpharmaciespreshd.com/">best canadian pharcharmy online</a>
      http://canadianpharmaciespreshd.com/
      <a href=http://canadianpharmaciespreshd.com/>best online international pharmacies</a>

      回复
    • pharmacy in canada

      <a href="http://canadianpharmacieshq.com/">canada pharmaceuticals online</a>
      http://canadianpharmacieshq.com/
      <a href=http://canadianpharmacieshq.com/>best online pharmacies</a>

      回复
    • canadian pharmacy reviews

      <a href="http://canadianfastpharmacy.com/">trust online pharmacy</a>
      http://canadianfastpharmacy.com/
      <a href=http://canadianfastpharmacy.com/>best online canadian pharmacy</a>

      回复
    • top canadian pharmacies

      <a href="http://canadianpharmacieshq.com/">list of reputable canadian pharmacies</a>
      http://canadianpharmacieshq.com/
      <a href=http://canadianpharmacieshq.com/>safe canadian pharmacies online</a>

      回复
    • trust pharmacy canada

      <a href="http://canadianpharmaciesdepot.com/">legitimate online pharmacies</a>
      http://canadianpharmaciesdepot.com/
      <a href=http://canadianpharmaciesdepot.com/>best 10 online pharmacies</a>

      回复
    • online pharmacy canada

      <a href="http://canadianpharmacieshq.com/">legitimate canadian pharmacy</a>
      http://canadianpharmacieshq.com/
      <a href=http://canadianpharmacieshq.com/>best canadian pharcharmy online</a>

      回复
    • CharlesHob

      tinder online , how to use tinder
      <a href=http://tinderdatingsiteus.com/?>tinder dating app </a>

      回复
    • CharlesHob

      tinder online , tinder app
      <a href=http://tinderdatingsiteus.com/?>tinder sign up </a>

      回复
    • free disabled dating sites

      free dating sites

      回复
    • Tinder dating site

      tinder dating app , tinder app
      <a href=http://tinderdatingsiteus.com/?>tindr </a>

      回复
    • Stephenpeaky

      viagra from canada <a href=" http://sild100fast.com/# ">viagra for sale</a> online pharmacy viagra

      回复
    • canadian online pharmacies legitimate

      <a href="http://canadianpharmacynethd.com/">list of legitimate canadian pharmacies</a>
      http://canadianpharmacynethd.com/
      <a href=http://canadianpharmacynethd.com/>list of legitimate canadian pharmacies</a>

      回复