I'm running the following script to create a connection to a vpn.

sshpass -p <pass> ssh -Nf -C -D <port> <user>@<ip>

Problem: sometimes the socket shuts down silently (maybe if not in use).

How can I add some kind of "keep alive" statement to the ssh connection?


1 Answer 1


With the help of link provided above, I'm trying now as follows:

...shh -o ServerAliveInterval=60 -o TCPKeepAlive=yes.

I've not had any drops since using it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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