Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using Macbook developing a client application.

I want to access server logs, so I opened a shell terminal and established a ssh connection to the server and access the log file there by executing

tail -f server.log

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

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

share|improve this question
    
Not duplicate, but related: unix.stackexchange.com/questions/20193/… –  depquid Apr 4 '13 at 12:02
    
Is it dying after being idle a certain amount of time, or is it dying a certain amount of time after start whether idle or not? –  Patrick Apr 4 '13 at 13:43
add comment

1 Answer

If the log file has a stead flow of data and the connection drops, then the cause is either A. Your firewall has a maximum tcp session time. B. There is some kind of reset happening, such has a hiccup in the wifi.

If you control both sides, you can install mosh: http://mosh.mit.edu/ which will reconnect, even if you change IPs or put your computer to sleep.

On the other hand, if the flow of data has long pauses, then you may be hitting the max idle timeout. You can add this to your ~/.ssh/config

Host *
        TCPKeepAlive yes
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.