0

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?

membersound
  • 431
  • 1
  • 5
  • 17
  • 1
    Take a look here, seems related to you problem: https://unix.stackexchange.com/questions/200239/how-can-i-keep-my-ssh-sessions-from-freezing/200256#200256 – Panki May 14 '19 at 10:50
  • [This Q&A is also related](https://superuser.com/questions/37738/how-to-reliably-keep-an-ssh-tunnel-open), and uses a different solution. – Seamus May 14 '19 at 11:36

1 Answers1

0

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.

membersound
  • 431
  • 1
  • 5
  • 17