V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
1dian01
V2EX  ›  问与答

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

  •  
  •   1dian01 · 2014-08-10 21:39:10 +08:00 · 4679 次点击
    这是一个创建于 3553 天前的主题,其中的信息可能已经有所发展或是发生改变。
    第 1 条附言  ·  2014-08-11 08:51:05 +08:00
    在mac系统中打开 /etc/ssh_config 文件,加入 ServerAliveInterval 15 ,问题解决
    10 条回复    2014-08-10 23:27:16 +08:00
    hjc4869
        1
    hjc4869  
       2014-08-10 21:45:36 +08:00
    这个问题我也经常遇到,不管是国内还是国外的VPS都是这样。
    yescola
        2
    yescola  
       2014-08-10 21:47:02 +08:00
    你们看着 等会儿就有高手来回答了!楼下出来吧!
    tomheng
        3
    tomheng  
       2014-08-10 21:52:12 +08:00
    设置下ServerAliveInterval 这个就行了。
    oldcai
        4
    oldcai  
       2014-08-10 22:11:30 +08:00
    /etc/ssh_config

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

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


    重新启动SSH服务,命令为:/etc/init.d/sshd restart
    sandtears
        6
    sandtears  
       2014-08-10 22:34:34 +08:00
    @yescola 别闹,你修改客户端设定,重启 sshd 服务干嘛
    yescola
        7
    yescola  
       2014-08-10 22:40:23 +08:00
    @sandtears 。。我是说的修改服务端。。。
    sandtears
        8
    sandtears  
       2014-08-10 22:40:54 +08:00
    @yescola /etc/sshd_config 才是服务端的配置文件。
    yescola
        9
    yescola  
       2014-08-10 22:43:26 +08:00
    @sandtears 赞一个。。!!!!!
    yescola
        10
    yescola  
       2014-08-10 23:27:16 +08:00
    @sandtears 如果是使用 iTerm 的话,修改 /etc/ssh_config 有作用吗?!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2249 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 06:05 · PVG 14:05 · LAX 23:05 · JFK 02:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.