Keeping SSH open?

Discussion in 'General Mac Discussion' started by darraghsmyth, Jun 7, 2004.

  1. darraghsmyth macrumors newbie

    Apr 26, 2004
    London, UK
    I've recently moved over to OS X from the PC. On the latter, there was an application called PuTTY that one could use to manage all your SSH connections. One of the nice features of PuTTY was that it could keep an SSH connection open by pinging it every 60 seconds when idle. This is particularly handy when one is jumping between applications all day and you don't want to keep re-opening the SSH connection every 30 minutes.

    On the Mac, I've found the SSH option in Terminal. However it always times-out when idle for 10 minutes or so. Does anyone know where I can increase the timeout limit or of any free Apps out there that can keep the SSH connections open? Alternatively, I'm happy to run SSH myself from the prompt line but I can't find any command line arguments to do this sort of thing ...

    thanks in advance
  2. Westside guy macrumors 603

    Westside guy

    Oct 15, 2003
    The soggy side of the Pacific NW
    If you have access to the ssh server's settings, there's a better way.

    By default, ssh uses a TCP check to see whether the current connection is alive; but that tends to not work correctly if you're behind NAT, firewalls or similar - so ssh assumes an idle connection has died and disconnects after a fairly short interval. But there's a built-in service (disabled by default) that is a much better measure of the connection's status; plus it runs through the ssh tunnel and is therefore less potentially exploitable. It's a two-step process though.

    1) Make the following change in the server sshd_config file:

    # Turn on SSH's internal keepalive feature
    ClientAliveInterval 60
    ClientAliveCountMax 10

    2) In your local settings (either edit the system ssh_config file, or else create/edit ~/.ssh/config) make the following change:

    KeepAlive no

Share This Page