Ssh connection doesn't respond after inactivity

Hi all,
do you know if is there any timeout on the sshof OSMC?
It happens to me that if I leave the shell where I’m connected via ssh for some minutes (don’t know how exactly) when I’m back on it it wan’t respond… seems freezed but if I open another tab of terminal I can succesfully connect again via ssh.

Nope, there is no timeout. I leave ssh sessions idle for hours sometimes without problems.

How are you connected - are you directly on the same network or going through a router ?

I’m going through a router (I’m forwarding a custom port to the ssh port of my raspy) and I’m connecting from internet (public ip )

Port forwarding goes through the NAT translation table on your router.

NAT tables have a timeout (which varies wildly from router to router but is typically about 15 minutes to 2 hours) after which a connection with no activity will be dropped. By default SSH connections do not send any tcp “keep-alive” packets when idle but some ssh clients allow you to enable a keep-alive.

PS I hope you have changed the default SSH password to a good strong one if you are port forwarding from the internet…

Thanks for your response! Now it’s clear to me why. :smile:
Yes, of course I’ve changed the deault password and I’m using an external port that is different from the standad.

I’m using a Linux CentOS machine to connect… is there a way to enable the keepalive from the bash of the OS?

This would probably work:

Yes! It seems to works fine!

Thaaanks! What a great forum! :wink: