0

I am using Macbook developing a client application.

I want to access server logs, so I opened a shell terminal & established a ssh connection to the server & access the log file there by executing tail -f server.log

It works, but the remote ssh session will be expired after certain amount of time, which needs me to establish the ssh connection again & access the server log file again.

How can I keep the remote session all the time without expiration??

1
  • 1
    You might be better suited to ask this on, say, "super user" or perhaps "unix & linux", or even "ask different". You'd have to check their FAQs though to know for sure.
    – J. Steen
    Apr 4, 2013 at 11:29

2 Answers 2

1

Use autossh on your Mac in conjunction with tmux or gnu screen on the server.

If you use a package manager on your Mac you will probably find that they're packaged.

1

One way of several to do this is to add the following line

   ServerAliveInterval 60

beneath the "Host *" stanza in the file /etc/ssh_config.

Since adding that line about a month ago, my ssh sessions have not timed out whilst tailing log files.

The file suggests looking at the ssh_config(5) man page for more information.

Here's my entire ssh_config file, with comments stripped out:

[mini-nevie:/etc] nevinwilliams% grep -v "^#" /etc/ssh_config




 Host *
   SendEnv LANG LC_*
   ServerAliveInterval 60

Host *
    XAuthLocation /opt/X11/bin/xauth

You must log in to answer this question.