1dian01
V2EX  ›  问与答

请教为啥 mac 下我用终端 ssh 上我的 vps 后过一会儿就没反应了(是自动断开?)

  •  
  •   1dian01 · Aug 10, 2014 · 5207 views
    This topic created in 4327 days ago, the information mentioned may be changed or developed.
    Supplement 1  ·  Aug 11, 2014
    在mac系统中打开 /etc/ssh_config 文件,加入 ServerAliveInterval 15 ,问题解决
    10 replies    2014-08-10 23:27:16 +08:00
    hjc4869
        1
    hjc4869  
       Aug 10, 2014
    这个问题我也经常遇到,不管是国内还是国外的VPS都是这样。
    yescola
        2
    yescola  
       Aug 10, 2014
    你们看着 等会儿就有高手来回答了!楼下出来吧!
    tomheng
        3
    tomheng  
       Aug 10, 2014
    设置下ServerAliveInterval 这个就行了。
    oldcai
        4
    oldcai  
    PRO
       Aug 10, 2014
    /etc/ssh_config

    里面加入两行:
    ServerAliveInterval 60
    ServerAliveCountMax 0
    应该就好了
    yescola
        5
    yescola  
       Aug 10, 2014
    @oldcai 你们都还没说完整,还要重启SSH服务才能生效!

    验证SSH服务状态,命令为:/etc/init.d/sshd status


    重新启动SSH服务,命令为:/etc/init.d/sshd restart
    sandtears
        6
    sandtears  
       Aug 10, 2014
    @yescola 别闹,你修改客户端设定,重启 sshd 服务干嘛
    yescola
        7
    yescola  
       Aug 10, 2014
    @sandtears 。。我是说的修改服务端。。。
    sandtears
        8
    sandtears  
       Aug 10, 2014
    @yescola /etc/sshd_config 才是服务端的配置文件。
    yescola
        9
    yescola  
       Aug 10, 2014
    @sandtears 赞一个。。!!!!!
    yescola
        10
    yescola  
       Aug 10, 2014
    @sandtears 如果是使用 iTerm 的话,修改 /etc/ssh_config 有作用吗?!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3242 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 12:24 · PVG 20:24 · LAX 05:24 · JFK 08:24
    ♥ Do have faith in what you're doing.