how to check whether the ssh tunnel is up

Gert Doering gert at greenie.muc.de
Fri May 10 19:33:54 EST 2013


Hi,

On Fri, May 10, 2013 at 10:44:59AM +0800, Vincent Lin wrote:
> I have an idea. If we get the ssh process ID, then we can check the local
> socket . Once the socket is established, the tunnel is OK. For example,
> 
>  ssh [...] -R 20001:localhost:22
> 
> We can check the socket that is used by specific ssh process. If the
> Foreign Address is localhost:22 and state is ESTABLISH, the tunnel is up.
> What do you think?

This is not how it works.

Unless someone actually connects to 20001 on the remote side, there is
nothing on the local side that you could see in "netstat"

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert at greenie.muc.de
fax: +49-89-35655025                        gert at net.informatik.tu-muenchen.de


More information about the openssh-unix-dev mailing list