I use bash script on the target host to make sure the forwarding was opened correctly. The SSH connection will run this and exit if there's a problem with the port forwarding, e.g.
client side script: ( this uses .ssh/config for port forwarding settings )
#!/bin/bash
while true; do
echo -n starting at : "
date
ssh user@server bin/sshloop.sh
echo "got back, sleeping 17 "
sleep 17
done
server side script ( bin/sshloop.sh )
#!/bin/bash
while true; do
echo $(date)" : SSH Reverse 1090:80, 1232:22 From Server to Client"
sleep 17
if ! netstat -an | grep -q ":::1090 " ; then
echo "1090 forward missing, bailing out"
exit
fi
done
Maybe even run the client side script under screen with -dmS
Do you actually need to make a terminal channel as well, or just the forwarding? – Ignacio Vazquez-Abrams – 2011-10-31T01:16:28.103
1@IgnacioVazquez-Abrams: Just the forwarding. – Matt Joiner – 2011-11-07T23:37:19.430