[linux-elitists] Fun* with ssh tunnels
David L. Anselmi
anselmi at anselmi.us
Sat Jul 31 22:51:08 PDT 2010
Don Marti wrote:
> I used to do this something like...
> ssh -L 10025:localhost:25 $MAILHOST sleep 5&
> /usr/bin/ssh -A -L 10025:localhost:25 \
> -R 10022:localhost:22 \
> $MAILHOST \
> /usr/bin/ssh -p 10022 localhost /usr/sbin/postqueue -f
> So the "postqueue" command is running on the client.
*That* is fun. How creative.
Might this also work though:
ssh -L 10025:localhost:25 $MAILHOST -N -f && /usr/sbin/postqueue -f
This seems to do the right thing if ssh can't connect, but maybe not if it connects but the remote
port isn't listening. Also the setting of ExitOnForwardFailure might matter.
The connection stays open (in the background) until signaled to stop. I think yours will be all
cleaned up after postqueue runs so maybe the extra convolution is worth it.
More information about the linux-elitists