I open an SSH tunnel programatically, with:
sshpass -p "my_password" ssh -fN -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes remote_user@remote_server.tld -L 13306:127.0.0.1:3306 sleep 3
and works as expected, but don't close after 3 seconds of inactivity.
I take the SSH PID and kill explicitly when the connection is finished; but I prefer the
sleep version, if can close the tunnel automatically.
The use with
sshpass maintain the tunnel open or am I doing something wrong?