SSH Connection

I have setup a sql forwarding connection to mysql server. However, the connection always hangup after 2hr... The problem can only be solved by resetting the ssh for this connection.

Is there something that I can configure, say TCP or session idle timeout to solve the problem ? Tsk

admin   8199  0.0  0.0  60464   912 ?        Ss   09:18   0:00 ssh -fNg -L 3306:localhost:3306 admin@mysqlserver
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

When you are creating your ssh tunnel use the following option to send a packet every 100 seconds to let the server know you are still active.

AXISHKAuthor Commented:
Where should it be setup, under /etc/ssh/ssh_config or /etc/ssh/sshd_config ?

What's the difference between these 2 files /

Currenty, I change the file sshd_config

ClientAliveInterval 3600
ClientAliveCountMax 4
TCPKeepAlive yes

You can set those in sshd_config, but then any ssh connection will never timeout, which is a security risk.  for example:

ClientAliveInterval 30
TCPKeepAlive yes
ClientAliveCountMax 99999

Instead, when you are putting in your command to bring your ssh tunnel up, you can set these variables yourself.

Read more here:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSH / Telnet Software

From novice to tech pro — start learning today.